[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

Steven D'Aprano steve at pearwood.info
Sun Apr 21 16:06:11 CEST 2013


On 21/04/13 15:33, Nick Coghlan wrote:

> The PEP is fine, as it already allows duplicate names without encouraging them:
>
>      class Insect(Enum):
>          wasp = 1  # Preferred. Use this in new code.
>          bee = 2
>          ant = 3
>      # Backwards compatibility aliases
>      Insect.wsap = Insect.wasp

Hmmm, I must have missed this.

That satisfies my use-cases. Objection withdrawn.




-- 
Steven


More information about the Python-Dev mailing list