diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-09-17 03:35:55 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-09-17 03:35:55 (GMT) |
commit | d9925a18ec1bc67d8835d0d29342c6c713c064af (patch) | |
tree | 1dbe43d9af32d8f7ae0fbab115d352076db4c4ac /Doc/library/enum.rst | |
parent | 52351c7037ca2e98d56907815f69e6441fcc5071 (diff) | |
download | cpython-d9925a18ec1bc67d8835d0d29342c6c713c064af.zip cpython-d9925a18ec1bc67d8835d0d29342c6c713c064af.tar.gz cpython-d9925a18ec1bc67d8835d0d29342c6c713c064af.tar.bz2 |
Close issue21706: add 'start' parameter to functional API
Diffstat (limited to 'Doc/library/enum.rst')
-rw-r--r-- | Doc/library/enum.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 503d305..af42c58 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -400,7 +400,8 @@ The second argument is the *source* of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/value pairs, or a mapping (e.g. dictionary) of names to values. The last two options enable assigning arbitrary values to -enumerations; the others auto-assign increasing integers starting with 1. A +enumerations; the others auto-assign increasing integers starting with 1 (use +the `start` parameter to specify a different starting value). A new class derived from :class:`Enum` is returned. In other words, the above assignment to :class:`Animal` is equivalent to:: @@ -438,12 +439,12 @@ SomeData in the global scope:: The complete signature is:: - Enum(value='NewEnumName', names=<...>, *, module='...', qualname='...', type=<mixed-in class>) + Enum(value='NewEnumName', names=<...>, *, module='...', qualname='...', type=<mixed-in class>, start=1) :value: What the new Enum class will record as its name. :names: The Enum members. This can be a whitespace or comma separated string - (values will start at 1):: + (values will start at 1 unless otherwise specified):: 'red green blue' | 'red,green,blue' | 'red, green, blue' @@ -461,6 +462,8 @@ The complete signature is:: :type: type to mix in to new Enum class. +:start: number to start counting at if only names are passed in + Derived Enumerations -------------------- |