Fwd: constant/enum type in stdlib
Nov. 24, 2010
5:23 p.m.
Hi -- If I may add my 0.02 cents - this sample has a sample implementation of the proposed features I found most interesting up to now: 1) inherit from int 2) display the constant's name on 'repr' 3) optionally populate a module with the constants 4) Optionally provide a starting value for the enum 5) Optionally provide a mapping with the values http://pastebin.com/6f1u35qJ (implementation is in python 2) Todo here: 6) Make them "read only" 7) Make the base type optional, with "int" as default - but also being able to create "constants" inheriting from other objects 8) more ideas? I am willing to play along this sample code as discussion goes on if there is any feedback. js -><-
5175
Age (days ago)
5175
Last active (days ago)
0 comments
1 participants
participants (1)
-
Joao S. O. Bueno