Nick Coghlan wrote:
1. The current PEP, offering only "getattr(MyEnum, name)".
>
2. We restore __getitem__ on EnumMetaclass *solely* for member lookup
by name

3. Use keyword arguments to distinguish two different
ways of calling the enum class:

   MyEnum(value = 1) --> lookup by value
   MyEnum(name = "foo") --> lookup by name

MyEnum(1) could be made equivalent to MyEnum(value = 1)
if it's thought that lookup by value will be the most
common or natural case.

Pros: Explicit is better than implicit.

Cons: Not so convenient to get a type-conversion function
to pass to other things.

--
Greg
_______________________________________________
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