PEP 354: Enumerations in Python

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Tue Feb 28 13:34:14 EST 2006


On Monday 27 February 2006 02:49, Ben Finney wrote:

> Coercing a value from an enumeration to a ``str`` results in the
> string that was specified for that value when constructing the
> enumeration::

That sentence seems to assume that all enumeration values will have been 
specified as strings. Thats reasonable, but your description of the creation 
of an enumeration doesnt specify that.

> An enumerated type is created from a sequence of arguments to the
> type's constructor::
> 
>     >>> Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')
>     >>> Grades = enum('A', 'B', 'C', 'D', 'F')

s/arguments/strings/

?

-- 
Toby Dickenson



More information about the Python-list mailing list