The Python language model is defined in /Applications/BBEdit.app/Contents/PlugIns/Language Modules/Python.bblm/Contents/Info.plist. I compared the symbols in the BBLMKeywordList and BBLMPredefinedNamesList sections of the document to the list of Python reserved keywords and builtins.
Several Python keywords/builtins do not appear in the syntax coloring list, including async, await, __debug__, Ellipsis, NotImplemented, and some more obscure stuff. I think these are all Python3 features, and I know async and await were not added as reserved keywords until v3.7, so perhaps BBEdit's syntax coloring for Python has not been updated in a while to reflect new tokens.
But, of more interest to me, there are also about a hundred items that do appear in the syntax coloring lists but are not Python keywords or builtins:
- Comparison and membership methods:
__cmp__, __contains__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__
- Iterator methods:
__iter__, __next__
- Sequence methods:
count, index (but not mutable sequence methods e.g. extend, reverse, insert…)
- String methods:
capitalize, casefold, center, count, encode, endswith, expandtabs, find, format, format_map, index, isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper, join, ljust, lower, lstrip, maketrans, partition, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill (but not bytes, bytesarray, or memoryview methods)
- Set methods:
add, clear, copy, difference, difference_update, discard, intersection, intersection_update, isdisjoint, issubset, issuperset, pop, remove, symmetric_difference, symmetric_difference_update, union
- Dict methods:
copy, fromkeys, get, items, keys, popitem, setdefault, update, values
- Context manager methods:
__enter__, __exit__
- Numeric modules and types:
Complex, decimal, Decimal, Fraction, fractions, Integral, Number, numbers, Rational, Real (but not cmath, random, or statistics)
- Module and class attributes:
__bases__, __class__, __dict__, __mro__, __qualname__, __subclasses__
- Commonly used convention:
self (but not cls)
An overwhelming majority of these tokens are methods and attributes defined on the Built-in Types page of the python docs — but as noted above, many other such methods are not included (like those for MutableSequences or binary sequences such as bytes). I don't know the logic by which the particular tokens included were chosen.
There is a README file located at /Users/[username]/Library/Application Support/BBEdit/Read Me.txt that describes how to add custom language models to BBEdit, which includes a note
**Note**: Do not open the BBEdit application package to extract or modify the language modules in there. That way lies madness.
But despite this probably sensible warning, I would nonetheless like to remove all these extra tokens that are not keywords or builtins of the language from getting syntax-colored, so I guess I'm about to find out just how much madness lies that way…