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/105889.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibMichael Foord fuzzyman at voidspace.org.uk
Tue Nov 23 16:40:28 CET 2010
On 23/11/2010 15:30, Antoine Pitrou wrote:
> 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.

Ah, I see. It is the auto-enumeration you disliked. Sure - not a problem.

I think the step that Nick described, of evaluating places in the 
standard library that this could be used, is a good one. I'll try to get 
around to it and perhaps attempt to resuscitate the PEP. (Any 
suggestions as to an appropriate module if having it live in its own 
module is still an objection?)

Michael

> Regards
>
> 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/

READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.

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