[New-bugs-announce] [issue23900] Add a default docstring to Enum subclasses

Nick Coghlan report at bugs.python.org
Thu Apr 9 18:42:37 CEST 2015

New submission from Nick Coghlan:

Issue #15582 added docstring inheritance to the inspect module. This means that Enum subclasses without their own docstring now inherit the generic docstring from the base class definition:

>>> import enum, inspect
>>> class MyEnum(enum.Enum):
...   a = 1
>>> inspect.getdoc(MyEnum)
'Generic enumeration.\n\nDerive from this class to define new enumerations.'

Perhaps the metaclass could automatically derive a more suitable docstring if the subclass doesn't set one of its own?

messages: 240348
nosy: barry, eli.bendersky, ethan.furman, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a default docstring to Enum subclasses
type: enhancement
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list