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