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-April/125719.html below:

can someone please summarize open issues?

[Python-Dev] enum discussion: can someone please summarize open issues? [Python-Dev] enum discussion: can someone please summarize open issues?Guido van Rossum guido at python.org
Mon Apr 29 19:38:46 CEST 2013
On Mon, Apr 29, 2013 at 9:47 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> At this point I think the best course is to not allow duplicates directly in
> the enum definition, but allow them after the fact:
>
> --> class Color(Enum):
> ...     red = 1
> ...     green = 2
> ...     blue = 3
>
> --> Color.grene = Color.green  # stupid legacy typo
>
> This gives us both some protection against accidental duplicates, while
> still allowing them when necessary; also, no confusion about which is the
> canonical name.

No. Poking a class has a code smell. It should be possible to define
the aliases inside the enum class definition. The canonical one is the
first one in definition order.

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