Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013年4月21日 14:53:17 -0700

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