On 23/11/2010 14:42, Antoine Pitrou wrote: > On Tue, 23 Nov 2010 14:24:18 +0000 > Michael Foord<fuzzyman at voidspace.org.uk> wrote: >> Well, for backwards compatibility reasons the new constants would have >> to *behave* like the old ones (including having the same underlying >> value and comparing equal to it). >> >> In many cases it is *likely* that subclassing int is a better way of >> achieving that. Actually looking through the standard library to >> evaluate it is the only way of confirming that. >> >> Another API, that reduces the duplication of creating the enum and >> setting the names, could be something like: >> >> make_enums("Names", "NAME_ONE NAME_TWO NAME_THREE", base_type=int, >> module=__name__) >> >> Using __name__ we can set the module globals in the call to make_enums. > I don't understand why people insist on calling that an "enum". enum is > a C legacy and it doesn't bring anything useful as I can tell. Instead, > just assign the values explicitly. > enum isn't only in C. (They are in C# as well at least.) Wikipedia links enum to "enumerated type" and says: an enumerated type (also called enumeration or enum) is a data type consisting of a set of named values It sounds entirely appropriate. I have no problem with explicitly assigning values instead of doing it automagically. All the best, Michael > Antoine. > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk -- http://www.voidspace.org.uk/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4