A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-November/105888.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibAntoine Pitrou solipsis at pitrou.net
Tue Nov 23 16:30:53 CET 2010
Le mardi 23 novembre 2010 à 15:15 +0000, Michael Foord a écrit :
> There are still two reasonable APIs (unless you have changed your mind 
> and think that sticking with plain integers is best), of which I prefer 
> the latter:
> 
> SOME_CONST = Constant('SOME_CONST', 1)
> OTHER_CONST = Constant('OTHER_CONST', 2)
> 
> or:
> 
> Constants = make_constants('Constants', 'SOME_CONST OTHER_CONST', start=1)

Or:

Constants = make_constants('Constants', 'SOME_CONST OTHER_CONST',   
                           values=range(1, 3))

Again, auto-enumeration is useless since it's trivial to achieve
explicitly.

Regards

Antoine.


More information about the Python-Dev mailing list

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