diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-09-16 20:35:55 -0700 |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-09-16 20:35:55 -0700 |
commit | f628dceb766bb8b1d6ca94b4319a420d3cd3832d (patch) | |
tree | 8a9221ed49b597c209c3880edc8918438eb17019 /Doc/library/enum.rst | |
parent | fe9a4fe83f83966d940eedd44917036df2e8e2d3 (diff) | |
download | cpython-f628dceb766bb8b1d6ca94b4319a420d3cd3832d.tar.gz |
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 503d305fca..af42c58a41 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 -------------------- |