[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Antoine Pitrou solipsis at pitrou.net
Wed Feb 27 14:30:01 CET 2013


Le Wed, 27 Feb 2013 12:33:35 +0900,
"Stephen J. Turnbull" <stephen at xemacs.org> a écrit :
> 
> As far as I can see, what you (Antoine) want is an identifier with a
> constant value, no more and no less.  Grouping into an enum is merely
> a lexical convention, since you are happy to compare enums of
> different enum classes and enums with ints.
> 
> I think such a thing is pretty generally desirable, but most of the
> people who have created Enum classes implement some type-checking that
> this value came from that Enum.  To me that is what differentiates an
> enumerated constant from a generic named constant.  I don't see why
> you keep deprecating that feature.  Do you really think it's useless,
> or is it just that you wouldn't use it yourself?

I just wouldn't care for it myself. I don't think extra-strong typing
of constants is really useful in practice; it smells a bit like private
methods to me.

Regards

Antoine.




More information about the Python-Dev mailing list