[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Barry Warsaw
barry at python.org
Fri Apr 26 00:29:34 CEST 2013
On Apr 25, 2013, at 03:19 PM, Guido van Rossum wrote:
>Clearly this is a trick question. :-)
A bit, yes. :)
>I was told when this was brought up previously (a week ago?) that it
>would be simple to make it truly the same class.
It didn't sound simple to me, but I haven't seen any actual code yet.
>I suppose you were going to propose to use isinstance() overloading,
>but I honestly think that Color.red.__class__ should be the same
>object as Color.
Yes, a custom __instancecheck__() is two lines of code.
I just can't get over the weirdness of a class having attributes which are
actual instances of itself.
-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-dev/attachments/20130425/147f2ec2/attachment.pgp>
More information about the Python-Dev
mailing list