diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2018-09-22 02:03:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-22 02:03:09 (GMT) |
commit | 5bdab641da0afd8aa581dfbde4f82d88d337c4b5 (patch) | |
tree | 492ee0a5d87717eeeb8abc992d71af18746f40c7 /Doc | |
parent | fd97d1f1af910a6222ea12aec42c456b64f9aee4 (diff) | |
download | cpython-5bdab641da0afd8aa581dfbde4f82d88d337c4b5.zip cpython-5bdab641da0afd8aa581dfbde4f82d88d337c4b5.tar.gz cpython-5bdab641da0afd8aa581dfbde4f82d88d337c4b5.tar.bz2 |
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
* bpo-29577: allow multiple mixin classes
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/enum.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 6408c01..702eacd 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -387,10 +387,17 @@ whatever value(s) were given to the enum member will be passed into those methods. See `Planet`_ for an example. -Restricted subclassing of enumerations --------------------------------------- +Restricted Enum subclassing +--------------------------- -Subclassing an enumeration is allowed only if the enumeration does not define +A new :class:`Enum` class must have one base Enum class, up to one concrete +data type, and as many :class:`object`-based mixin classes as needed. The +order of these base classes is:: + + def EnumName([mix-in, ...,] [data-type,] base-enum): + pass + +Also, subclassing an enumeration is allowed only if the enumeration does not define any members. So this is forbidden:: >>> class MoreColor(Color): |