[docs] [issue25594] enum instance attribute access possible

Ethan Furman report at bugs.python.org
Fri Nov 13 13:18:24 EST 2015


Ethan Furman added the comment:

Thanks for tracking that down.

After more research I'm inclined to leave the code as it is and revamp the docs to clarify that while it may work, the results may not be what you want:

-- 8< -------------------
class Color(Enum):
    red = 1
    blue = 2
    name = 3

print(Color.name)         # Color.name
print(Color.name.blue)    # Color.blue
print(Color.blue.name)    # 'blue'  (not Color.name!)
-- 8< -------------------

Patch attached.

----------
stage: needs patch -> patch review
Added file: http://bugs.python.org/file41030/issue25594.stoneleaf.01.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25594>
_______________________________________


More information about the docs mailing list