Lines Matching refs:enumeration
5 :synopsis: Implementation of an enumeration class.
18 An enumeration is a set of symbolic names (members) bound to unique,
19 constant values. Within an enumeration, the members can be compared
20 by identity, and the enumeration itself can be iterated over.
32 This module defines four enumeration classes that can be used to define unique
75 `Functional API`_. To define an enumeration, subclass :class:`Enum` as
94 - The class :class:`Color` is an *enumeration* (or *enum*)
96 *enumeration members* (or *enum members*) and are functionally constants.
117 The *type* of an enumeration member is the enumeration it belongs to::
155 Programmatic access to enumeration members and their attributes
221 Ensuring unique enumeration values
226 ensure each value is used only once in the enumeration:
231 enumeration's :attr:`__members__` gathering any aliases it finds; if any are
296 to members. It includes all names defined in the enumeration, including the
308 the enumeration members. For example, finding all the aliases::
326 Ordered comparisons between enumeration values are *not* supported. Enum
343 Comparisons against non-enumeration values will always compare not equal
354 The examples above use integers for enumeration values. Using integers is
357 the actual value of an enumeration is. But if the value *is* important,
361 usual. If we have this enumeration::
376 ... # cls here is the enumeration
391 attributes defined within an enumeration will become members of this
392 enumeration, with the exception of special methods (:meth:`__str__`,
396 Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` then
411 Also, subclassing an enumeration is allowed only if the enumeration does not define
419 TypeError: MoreColor: cannot extend enumeration 'Color'
458 :meth:`__reduce_ex__` in the enumeration class.
477 argument of the call to :class:`Enum` is the name of the enumeration.
479 The second argument is the *source* of enumeration member names. It can be a
501 enumeration is being created in (e.g. it will fail if you use a utility
667 other :class:`Flag` enumeration, nor :class:`int`. While it is possible to
717 semantic promises of an enumeration (by being comparable to integers, and
802 In many use-cases one doesn't care what the actual value of an enumeration
803 is. There are several ways to define this type of simple enumeration:
927 An ordered enumeration that is not based on :class:`IntEnum` and so maintains
1106 be provided. It will be checked against the actual order of the enumeration