Comments (2)
You can actually have code in your class statements. Let me show an example of shadowing the sum
name in the class body:
class Foo:
spam = 'bar'
sum = 123
bar = 'spam'
# Lot's of code before this line
CONSTANT = sum([i for i in range(100)])
# And now methods
def say(self):
return self.spam
Another thing is that I doubt we can detect that we're lexing a body of a class reliably. And even if that's possible, it would complicate the grammar too much.
So, unfortunately, this one is "won't fix".
from magicpython.
Thanks for the explanation. Unfortunate indeed.
from magicpython.
Related Issues (20)
- ST4 loading error: Error in regex HOT 2
- Incorrect tokenization of querystring
- python string syntax highlight errors HOT 2
- Python function annotation is not working
- Support for Python PEP 677 in Python TextMate grammar HOT 1
- No ability to configure soft vs hard tabs when using tab type auto HOT 7
- Intellij support
- Highlight all PEP-0350 defined codetags
- Interpreter Stops Working
- Getting invalid.illegal.name.python on valid python code from textmate
- Syntax highlighting issue when @ appears as first character after line continuation when indexing is present
- Syntax Highlighting regex+format strings (rf)
- `#` in read-only string highlights as a comment
- Boolean True/False independent highlight support
- Wrong highlight for raw string HOT 4
- Tag and push the python 3.8 and 3.10 syntax additions to Pulsar
- Decorator Syntax Errors
- Support for PEP 695 (Type parameters / generics)
- Python modulo operator parsed in a string
- support python 3.12 type alias syntax HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magicpython.