Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a12329

Browse files
committed
Issue22997: minor doc update; thanks to Simoen Visser
1 parent 2f825af commit 8a12329

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Doc/library/enum.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ enumerations; the others auto-assign increasing integers starting with 1. A
404404
new class derived from :class:`Enum` is returned. In other words, the above
405405
assignment to :class:`Animal` is equivalent to::
406406

407-
>>> class Animals(Enum):
407+
>>> class Animal(Enum):
408408
... ant = 1
409409
... bee = 2
410410
... cat = 3
@@ -421,7 +421,7 @@ enumeration is being created in (e.g. it will fail if you use a utility
421421
function in separate module, and also may not work on IronPython or Jython).
422422
The solution is to specify the module name explicitly as follows::
423423

424-
>>> Animals = Enum('Animals', 'ant bee cat dog', module=__name__)
424+
>>> Animal = Enum('Animal', 'ant bee cat dog', module=__name__)
425425

426426
.. warning::
427427

@@ -434,7 +434,7 @@ The new pickle protocol 4 also, in some circumstances, relies on
434434
to find the class. For example, if the class was made available in class
435435
SomeData in the global scope::
436436

437-
>>> Animals = Enum('Animals', 'ant bee cat dog', qualname='SomeData.Animals')
437+
>>> Animal = Enum('Animal', 'ant bee cat dog', qualname='SomeData.Animal')
438438

439439
The complete signature is::
440440

@@ -447,6 +447,10 @@ The complete signature is::
447447

448448
'red green blue' | 'red,green,blue' | 'red, green, blue'
449449

450+
or an iterator of names::
451+
452+
['red', 'green', 'blue']
453+
450454
or an iterator of (name, value) pairs::
451455

452456
[('cyan', 4), ('magenta', 5), ('yellow', 6)]

0 commit comments

Comments
 (0)