Am I the only one who would love these extentions? - Python3.0proposals (long)

Georgy Pruss SEE_AT_THE_END at hotmail.com
Thu Nov 13 00:13:02 CET 2003


I like it. Thanks!
G-:

"Dave Brueck" <dave at pythonapocrypha.com> wrote in message news:mailman.673.1068658670.702.python-list at python.org...
| > I like some of your suggestions, like enum.
|
| I wouldn't mind having a standard module include something like this:
|
| class Enumerate(object):
|     def __init__(self, names):
|         for number, name in enumerate(names.split()):
|             setattr(self, name, number)
|
| WORK = Enumerate('NONE WRITE READ SENDFILE CONNECT ACCEPT')
|
| I like it better than C-style enums because it's clear that the element
| comes from a particular enumeration, e.g.:
|
| workFlags = WORK.WRITE
|
| -Dave
|
|






More information about the Python-list mailing list