Guido van Rossum <gu...@python.org> writes:
> On Sat, Apr 27, 2013 at 10:04 AM, Ethan Furman <et...@stoneleaf.us> wrote:
>> While this will certainly work, it means you can't have class variables that
>> happen to be the same type as the enum -- so no int in an IntEnum, for
>> example.
>>
>> The solution I like best is the helper class (called, originally enough,
>> enum), and only those items get transformed:
>>
>> class Planet(IntEnum):
>>     MERCURY = enum(1)
>>     VENUS = enum(2)
>>     EARTH = enum(3)
>>     rough_pi = 3     # not transformed
>
> If this means that the most plain vanilla enum definition still has to
> use the enum(i) notation, I'm against it.

I think this is actually a big advantage. It makes it obvious that
something special is going on without having to know that IntEnum uses a
special metaclass.


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

_______________________________________________
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