Pro-tip: put things like this in your ~/.pythonrc so that they're loaded when you start the REPL. I have a few things in mine, like configuring readline, a couple of functions to dump objects as JSON or YAML, and imports for pprint and datetime so that they're all there when I'm doing interactive stuff.
`__foo` is probably not meant for external use, but the real reason to use the leading double underscore is to invoke that name mangling and thus avoid name collisions in subclasses. Some people do still use this feature. (These days, I barely even use inheritance.)
Perhaps it could use the same colour for the `_x` as for other single-underscore names, and a fourth colour for the `__foo` part.
Perhaps it could use the same colour for the `_x` as for other single-underscore names, and a fourth colour for the `__foo` part.