[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Barry Warsaw
barry at python.org
Sun Apr 21 23:51:13 CEST 2013
On Apr 21, 2013, at 03:25 PM, Nick Coghlan wrote:
>Agreed. I think the stdlib enum library should use __prepare__ and
>iterate in definition order (since 2.x compatibility isn't of any
>concern), while flufl.enum can use "sorted by name" as the iteration
>order.
>
>An "order_by_name" keyword argument to __prepare__ in the stdlib
>version could then allow the user to opt in to the flufl.enum
>behaviour, while still using definition order by default.
Seriously, why all the extra complexity for something you'll never care about?
You don't care about the exact contents of __repr__ as long as it's
predictable. You don't really care about item iteration order either as long
as it's defined. Sorting by attribute name fulfills both use cases *and* it's
simple. Zen 3 FTW.
-Barry
More information about the Python-Dev
mailing list