[Python-Dev] constant/enum type in stdlib
Glenn Linderman
v+python at g.nevcal.com
Sat Nov 27 21:56:14 CET 2010
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).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101127/c8056d0e/attachment.html>
More information about the Python-Dev
mailing list