Py3K idea: why not drop the colon?

sjdevnull at sjdevnull at
Mon Nov 13 22:21:22 CET 2006

Michael Hobbs wrote:
> No, old research does is not automatically invalidated, but
> out-of-context research is. I'm sure there's research somewhere proving
> that code written in ALL UPPERCASE is preferable, since it makes
> punched-cards easier to read by humans. Python 1.0 may have been a nice
> language for "newbies", with a lot of similarities to ABC, but there has
> been a lot of evolution since then. Sure, it's still very easy to teach
> basic Python, but if you're concerned about readability, take a look at
> any real-world Python app or library. You'll find it's filled with
> things such as "__getattr__", "__repr__", "__nonzero__", and
> "super(MyClass, self).__init__()". Hardly newbie stuff.


Just looking at our real-world Python code (roughly 325,000 lines of
code in about 5,000 files), I see:
3 classes define __getattr__
1 call to __getattr__, which is an upcall from within one of those 3
__getattr__ definitions
17 classes define __repr__
0 explicit __repr__ calls
0 calls or definitions of __nonzero__
0 calls to super

That's hardly "filled with" in my book.

Really, there are only 3 widely used __foo__ strings in most of the
real-world Python code I've seen; __init__, __name__=="__main__" tests,
and __class__.

Aside from those, I normally see __foo__ tags only where you'd really
expect to--custom importers, dictionaries with lazy value retrieval,
class definitions overriding default behavior, etc.  Not newbie stuff
at all, and not particularly common.

Of the 5,000 files we have, only 80 have any __foo__ tag aside from the
3 widely used ones.

More information about the Python-list mailing list