[docs] [issue23292] Enum doc suggestion

Eli Bendersky report at bugs.python.org
Sat Jan 24 13:23:33 CET 2015

Eli Bendersky added the comment:

I'm not sure why the current situation is annoying?

Python explicitly does not pollute the enclosing namespace with an Enum's members. So when you:

import A

It's fairly natural that you have access to A.MyEnum and not its members, no? Some modules (like some stdlib modules) may choose to push the enum members up to the module's scope explicitly, but I wouldn't necessarily call it best practice. Namespacing is Pythonic, splashing contents of classes into enclosing namespaces isn't.

So I guess what I'm trying to say is that I don't see a reason to explicitly suggest something that is, in general, against the spirit of Python, in the documentation.

[P.S. Thanks for reporting, Mark, I love your books!]


Python tracker <report at bugs.python.org>

More information about the docs mailing list