[Python-ideas] constant/enum type in stdlib
Tim Delaney
timothy.c.delaney at gmail.com
Wed Feb 13 03:20:31 CET 2013
On 13 February 2013 12:51, Tim Delaney <timothy.c.delaney at gmail.com> wrote:
> And more ...
>
And inspired by the other thread, Ellipsis (...) is now used to indicate
"use the next value". Ellipsis can either be assigned to an enum value, or
passed as the first parameter to EnumParams or when calling the enum value
during construction.
None is no longer valid.
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from enum import Enum
>>> class MyEnum(Enum):
... A
... B, C, D = ..., 5, ...
... E = ...
... F(..., 'f')
...
>>> MyEnum
<enum __main__.MyEnum {<EnumValue 'A': 0>, <EnumValue 'B': 1>, <EnumValue
'C': 5>, <EnumValue 'D': 6>, <EnumValue 'E': 7>, <EnumValue 'F': 8>}>
I'm stopping now.
Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130213/5c27c124/attachment.html>
More information about the Python-ideas
mailing list