On Tue, 23 Apr 2013 15:44:58 +0200, Antoine Pitrou <solip...@pitrou.net> wrote:
> Le Fri, 12 Apr 2013 05:55:00 -0700,
> Eli Bendersky <eli...@gmail.com> a écrit :
> > 
> > We're happy to present the revised PEP 435, collecting valuable
> > feedback from python-ideas discussions as well as in-person
> > discussions and decisions made during the latest PyCon language
> > summit. We believe the proposal is now better than the original one,
> > providing both a wider set of features and more convenient ways to
> > use those features.  
> 
> I'm having a problem with the proposed implementation. I haven't found
> any mention of it, so apologies if this has already been discussed:
> 
> >>> from flufl.enum import *
> >>> class C(Enum):
> ...  a = 1
> ...  b = 2
> ... 
> >>> C.a.__class__
> <class 'flufl.enum._enum.EnumValue'>
> >>> 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.  The second
certainly looks odd, but what does it even mean to have an instance of
an Enum class?

--David
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
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