[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 27 05:55:09 CET 2013


Stephen J. Turnbull wrote:
> Worse for me, most of the applications I have, I'd like the enumerator
> identifiers to be both string-valued and int-valued: the int used to
> index into Python sequences, and the string used in formatting SQL.

Is the string value required the same as the name used in
Python code? If so, this requirement would be met by having
__index__ return the int value and __str__ return the
unqualified name.

-- 
Greg



More information about the Python-Dev mailing list