PEP 354: Enumerations in Python

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Feb 28 19:57:48 EST 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> say that 
>    Weekdays = enum('mon', 'tue', ...)
>
> What is the type of Weekdays.mon supposed to be?

The specification doesn't mention that; it should.

I'm calling them EnumValue, but that makes it difficult to talk
about. The term "value" is commonly used to refer to an instance of a
type, so "enumeration value" sounds like an instance of the type
"enumeration", which is confusing.

Perhaps, since "collection" seems the right metaphor for an
enumeration, each of the values in an enumeration should be
EnumMember. On the assumption these might be basic types, though, that
name doesn't read so easily in lowercase ('enummember').

Thoughts?

-- 
 \       "What I resent is that the range of your vision should be the |
  `\                              limit of my action."  -- Henry James |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list