On 05/05/2013 02:55 PM, Tim Delaney wrote:

So long as I can get one of the requirements documented to implement an 
auto-number syntax I'll be happy enough with
stdlib enums I think.

class Color(AutoIntEnum):
     red = ...
     green = ...
     blue = ...


Will this do?

    class AutoNumber(Enum):
        def __new__(cls):
            value = len(cls.__enum_info__) + 1
            obj = object.__new__(cls)
            obj._value = value
            return obj
        def __int__(self):
            return self._value
    class Color(AutoNumber):
        red = ()
        green = ()
        blue = ()

--
~Ethan~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to