[Python-ideas] Enums

Barry Warsaw barry at python.org
Mon Jul 25 19:23:57 CEST 2011


On Jul 24, 2011, at 11:32 PM, Chris Rebert wrote:

>- Why violate TOOWTDI by having both SomeEnum(...) and SomeEnum[...]
>that do the same thing?

I don't remember exactly, but there was some historical reasons for including
both syntaxes.

>- Why is it .enumname and not simply .name? .enumname could also be
>confused as getting the name of the overarching enum rather than the
>name of the particular enum value.

Again, historical accident.  Probably .enumname was chosen to mimic
.enumclass, since obviously .class couldn't be used.  Since these are
attributes on enumeration values, .name and .enum might have been better
choices.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110725/191fcf16/attachment.pgp>


More information about the Python-ideas mailing list