On Mon, May 16, 2005, Guido van Rossum wrote: > > My rule has more to do with who "owns" the namespace on the one hand, > and with "magic" behavior caused (or indicated) by the presence of the > attribute on the other. Class or instance is irrelevant; that most > magic attributes live on classes or modules is just because those are > places where most of the magic is concentrated. > > __init__ in a class is a system attribute because it has a magic > meaning (invoked automatically on instantiation). __file__ and > __name__ in a module (and __module__ and __name__ in a class!) are > system attributes because they are "imposing" on the user's use of the > namespace. (Note: next was a mistake; it should have been __next__ > because of the "magic" rule.)
>From my POV, part of the reasoning should be the extent to which the attribute is intended to be publicly accessible -- part of the primary documented interface. __init__ is magic, fine. But __name__ isn't part of the primary use for a class, whereas these new exception attributes will be part of the public interface for exceptions, just like the methods for the Queue class. (I'm using Queue in specific because it's intended to be subclassed.) -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "And if that makes me an elitist...I couldn't be happier." --JMS _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com