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

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibRaymond Hettinger raymond.hettinger at gmail.com
Sun Nov 28 00:26:13 CET 2010
On Nov 27, 2010, at 12:56 PM, Glenn Linderman wrote:

> On 11/27/2010 2:51 AM, Nick Coghlan wrote:
>> 
>> Not quite. I'm suggesting a factory function that works for any value,
>> and derives the parent class from the type of the supplied value.
> 
> Nick, thanks for the much better implementation than I achieved; you seem to have the same goals as my implementation.  I learned a bit     making mine, and more understanding yours to some degree.  What I still don't understand about your implementation, is that when adding one additional line to your file, it fails:
> 
> w = named_value("ABC", z )
> 
> Now I can understand why it might not be a good thing to make a named value of a named value (confusing, at least), but I was surprised, and still do not understand, that it failed reporting the __new__() takes exactly 3 arguments (2 given).

Can I suggest that an enum-maker be offered as a third-party module rather than prematurely adding it into the standard library.


Raymond
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