Double underscores -- ugly?

benhoyt benhoyt at gmail.com
Thu Feb 21 14:37:15 EST 2008


> Has anyone thought about alternatives? Is there a previous discussion
> on this I can look up?

Okay, I just emailed the BDFL and asked if he could tell me the origin
of the double underscore syntax for __special__ methods, and what he
said I'm pretty sure he won't mind me posting here:

> [Guido van Rossum said:]
> The specific naming convention was borrowed from the C standard, which
> reserves names like __FILE__ and __LINE__. The reason for needing a
> convention for "system-assigned" names was that I didn't want users to
> be surprised by the system giving a special meaning to methods or
> variables they had defined without intending that special meaning,
> while at the same time not wanting to introduce a physically separate
> namespace (e.g. a separate dict) for system names. I have no regrets.

After that and this thread, I'm pretty good with it, I guess. :-)

Cheers,
Ben.



More information about the Python-list mailing list