Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013年5月03日 23:55:47 -0700

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
[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