A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-May/125872.html below:

can someone please summarize open issues?

[Python-Dev] enum discussion: can someone please summarize open issues?Guido van Rossum guido at python.org
Thu May 2 17:47:47 CEST 2013
On Thu, May 2, 2013 at 7:58 AM, Barry Warsaw <barry at python.org> wrote:
> On May 02, 2013, at 11:44 AM, Greg Ewing wrote:
>
>>Barry Warsaw wrote:
>>> Why isn't getattr() for lookup by name
>>> good enough?
>>
>>Because it will find things that are not enum items,
>>e.g. '__str__'.
>
> Why does that matter?

I claim it doesn't.

The name lookup is only relevant if you already know that you have a
valid name of an enum in the class, e.g. if you know that a Color name
was written earlier. If you don't, you should do some other check,
e.g. "if x in Color:". (Note that from this you cannot derive that
Color[x] should work.)

-- 
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4