[Python-Dev] PEP 435 - requesting pronouncement (original) (raw)

Guido van Rossum guido at python.org
Sun May 5 19:35:36 CEST 2013


This has all long been hashed out, and I've pronounced on this already. I'm sorry you weren't there for the bikeshedding, but nothing you say here is new and it was all considered carefully.

On Sun, May 5, 2013 at 10:07 AM, Charles-François Natali <cf.natali at gmail.com> wrote:

I'm chiming in late, but am I the only one who's really bothered by the syntax?

class Color(Enum): red = 1 green = 2 blue = 3 I really don't see why one has to provide values, since an enum constant is the value. In many cases, there's no natural mapping between an enum constant and a value, e.g. there's no reason why Color.red should be mapped to 1 and Color.blue to 3. Furthermore, the PEP makes it to possible to do something like: class Color(Enum): red = 1 green = 2 blue = 3 redalias = 1

which is IMO really confusing, since enum instances are supposed to be distinct. All the languages I can think of that support explicit values (Java being particular in the sense that it's really a full-fledge object which can have attributes, methods, etc) make it optional by default. Finally, I think 99% of users won't care about the assigned value (which is just an implementation detail), so explicit value will be just noise annoying users (well, me at least :-). cf

2013/5/5 Eli Bendersky <eliben at gmail.com>: Hello pydev, PEP 435 is ready for final review. A lot of the feedback from the last few weeks of discussions has been incorporated. Naturally, not everything could go in because some minor (mostly preference-based) issues did not reach a consensus. We do feel, however, that the end result is better than in the beginning and that Python can finally have a useful enumeration type in the standard library. I'm attaching the latest version of the PEP for convenience. If you've read previous versions, the easiest way to get acquainted with the recent changes is to go through the revision log at http://hg.python.org/peps A reference implementation for PEP 435 is available at https://bitbucket.org/stoneleaf/ref435 Kind regards and happy weekend.


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/cf.natali%40gmail.com


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list