>
> The class statement works in this fashion.
>
>
I would argue there are at least 2 significant reasons why a separate
namespace would be preferred over using class in this way:
1. using class in this way signals to the user that you are writing a
class (ie, meant to be instantiated), and not a namespace; the author has
to tell the reader it isn't actually intended to be a class in the
docstring or in the class name ("eg, MyNamespace")
2. using class means that all of the "new style class" machinery is at
work-- for good or for ill-- when working in your class-defined namespace.
so if, for example, you create a descriptor and instantiate it inside a
class namespace, the descriptor __get__ method will be invoked when
accessing the descriptor via the class name. this could be very limiting in
certain cases.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/KUFOJ4FK2H76JA5KO3H5AZAY2NYD3P5M/
Code of Conduct: http://python.org/psf/codeofconduct/