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

Nick Coghlan ncoghlan at gmail.com
Sat May 4 04:11:33 CEST 2013


On 4 May 2013 09:34, "Guido van Rossum" <guido at python.org> wrote:
>
> On Fri, May 3, 2013 at 4:08 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:
> > Guido van Rossum wrote:
> >>
> >> I haven't seen code in the style that
> >> Greg proposes in decades,
>
> > What style are you talking about here?
>
> Code that wants to validate a string the user typed as input. Web
> forms just don't work that way. (Command-line flags are a special
> case, and there are a slew of specialized parsers for that case.)

And for code that really needs it, it is straightforward to use dir(MyEnum)
and isinstance(obj, MyEnum) to get an exact mapping of names to values that
also accounts for aliases.

Cheers,
Nick.

>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> 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/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130504/184f0af5/attachment.html>


More information about the Python-Dev mailing list