Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013年4月25日 11:54:02 -0700

On Apr 23, 2013, at 10:24 AM, R. David Murray wrote:
>> >>> isinstance(C.a, C)
>> False
>> >>> isinstance(C(1), C)
>> False
>> 
>> It would really be better if instances were actual instances of the
>> class, IMO.
>
>The first False looks correct to me, I would not expect an enum value to be
>an instance of the class that holds it as an attribute.
Agreed, completely.
>The second certainly looks odd, but what does it even mean to have an
>instance of an Enum class?
It only looks odd because it's using failed, duplicate, deprecated syntax.
Does this look similarly odd?
>>> isinstance(C[1], C)
False
given that ``C[1] is C.a``?
-Barry
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to