Comments (4)
Strictly speaking self
is not really a keyword but yeah it would be good to highlight it (and the other strong conventional keyword cls
as well)
from python-syntax.
Well, it was discussed a little bit before in #10.
I don't want to add highlighting for self
for a number of reasons:
- I actually tried it and I don't really like how it looks. It adds too many colors to the code to the point that it's getting harder to follow.
- As @lonetwin already mentioned,
self
is actually just a conventional name for the first argument of a method. And if somebody uses for example justs
instead it won't be highlighted and just will be confusing. - As it just an argument of a method it also can raise a question "why the other arguments not highlighted?" and also can add to the confusion.
from python-syntax.
It is a conventional name, but it is used in literally 99.99% of all OO Python code. I have worked with Python almost exclusively for the better part of a decade, and I have never seen anyone use anything but self
. So, if someone averts themselves from this de facto standard, I don't think they will be confused if their tooling would not follow suit 100%. Even if they are, I would argue that the other 99.99% of all users would be happy to have all their keywords highlighted.
For your first and second points, they can be tweaked. self
highlight could be a default-on option so that it can be disabled, and adding highlights for other arguments is actually something that can be done. I have already implemented a light way (highlighting *args
and **kwargs
and the value part of key=value
) into this project, but I was holding off on making PRs until this was resolved. Guess I won't be adding them.
I'll respect your decision, but I'll also express some general concern about the Open Source way of disregarding useful ideas and changes because they might be troublesome for a single hypothetical power user. The lack of colored prompts and tab completion in default Debian and Ubuntu shells come to mind; the argument was that people still using print terminals or really slow computers would have a slightly worse time.
from python-syntax.
Probably not so good example but there's a class which uses s
instead of self
: https://hg.python.org/cpython/file/3.4/Lib/sched.py#l45
I'll respect your decision, but I'll also express some general concern about the Open Source way of disregarding useful ideas and changes because they might be troublesome for a single hypothetical power user.
I think the main point of Open Source is that you can create your own version of a project if you think that your changes are useful and they can't be incorporated to the mainline version for some reason. It's actually one of the reasons why this project exists.
from python-syntax.
Related Issues (20)
- datetime formatting in "{}" formay string
- None is highlighted differently in Python 3 than in Python 2 HOT 2
- "{{" not recognized as an escape HOT 1
- Please add new syntax (await, async) highlight HOT 1
- The identifier next to "async def" is not highlighted as function name HOT 2
- Function annotations? HOT 1
- No difference in highlighting of `print` between Python 2 and 3 HOT 1
- More module attributes HOT 1
- self isn't highlighted in classes HOT 6
- highlight keyword in keyword arguments in function calls with kwargs HOT 1
- highliting isn't semantic aware. HOT 1
- matrix multiplication HOT 1
- `is not` does not highlight
- exec is a function under Python3, not a statement HOT 2
- How to enable folding ? HOT 4
- async / await not highlighted
- Python 3.6 f-string literal support HOT 2
- Python 3.6 underscores in numeric literal support HOT 1
- This project is dead, time to fork HOT 6
- Tabbing behaviour is broken
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 python-syntax.