[Python-ideas] Enums
Barry Warsaw
barry at python.org
Thu Jul 28 01:00:57 CEST 2011
On Jul 28, 2011, at 08:24 AM, Nick Coghlan wrote:
>For compatibility reasons, though, I believe it is worth following the
>precedent set by bool: if integer constants are to be replaced by
>named values, the replacement needs to support everything the previous
>value did. The easiest way to achieve that is by inheriting directly
>from the previous value's type.
I mentioned in a separate follow up that I'd be open to that, if someone wants
to submit a patch.
>1. I find the "enum" concept too limiting. NamedValue (as a mixin
>class) is a better building block since it separates the naming aspect
>from the "group of values" aspect implied by enum.
I think that's all fine, but it's getting far from *my* simple concept of
enumerated values. Go for it though. :)
>But the grouping behaviour? I really don't see a lot of value in that
>- just boilerplate. We don't write bool.True and bool.False, we write
>True and False.
That's only because True and False are bound in a particular module namespace.
There's no reason why specific EnumValues couldn't also be similarly bound.
-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/20110727/50a4984b/attachment.pgp>
More information about the Python-ideas
mailing list