Background: For those not familiar with it, Sublime Text (and TextMate) provides syntax highlighting and other features through scopes which are defined by .tmLanguage
language definition files, basically a bunch of regexes to identify various constructs in a given language, such as function definitions, various types of strings, reserved words, etc.
I'm the maintainer of the Python Improved package (available via Package Control if you're interested) that aims to be a better language definition for Python. You can read about it at GitHub if you want, but one of the key features is that it's actually maintained, unlike many of the Sublime languages that haven't been changed or updated in years.
The question: I've been focusing recently on double-underscored __magic__
stuff, and after finding this excellent treatise by Rafe Kettler on magic functions I was able to expand that part of the language definition quite a bit. However, I've had a bit less luck on finding a good list of built-in magic variable names, or magic attributes, like __class__
or __doc__
. I've gone through the Data Model section of the docs, but it leaves a little bit to be desired for my purposes, and seems to focus mainly on magic method names.
So my question is, what should be included in the support.variable.magic.python
scope? This is its definition so far:
\b__(all|bases|class|debug|dict|doc|file|members|metaclass|methods|module|name|slots|weakref)__\b
One of the reasons I started this project was to teach myself more about Python, and I've definitely been succeeding so far, but I'm kind of stuck at this point.
Just to be clear, I'm not looking for a favorite off-site resource (although if you have a handy link I'd appreciate it) and I'm not trying to start an opinionated discussion. All I'm trying to figure out is if this list looks reasonable as-is, or if there are any glaring errors. If you do want to be opinionated, open an issue and I'd be more than happy to discuss.
Thanks!