Issue 23900: Add a default docstring to Enum subclasses (original) (raw)

Issue23900

Created on 2015-04-09 16:42 by ncoghlan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg240348 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2015-04-09 16:42
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?
msg240486 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2015-04-11 16:47
We could do something like: 'An enumeration.' and perhaps even something like: 'An enumeration based on .' It's not much, but is better than the obviously wrong generic version.
msg240545 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-12 06:23
New changeset 684aadcabcc7 by Ethan Furman in branch 'default': Close : add default __doc__ to new enumerations that do not specify one. https://hg.python.org/cpython/rev/684aadcabcc7
msg240856 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-04-14 08:03
May be don't add __doc__ if sys.flags.optimize >= 2?
History
Date User Action Args
2022-04-11 14:58:15 admin set github: 68088
2015-04-14 08:03:04 serhiy.storchaka set messages: +
2015-04-12 06:23:24 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: needs patch -> resolved
2015-04-11 16:47:07 ethan.furman set assignee: ethan.furmanmessages: +
2015-04-09 16:42:37 ncoghlan create