From 48a724fa33143bcbab2228058d3f59e1813bd49c Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Sat, 11 Apr 2015 23:23:06 -0700 Subject: Close issue23900: add default __doc__ to new enumerations that do not specify one. --- Lib/enum.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Lib/enum.py') diff --git a/Lib/enum.py b/Lib/enum.py index 1d9ebf0f94..c28f3452a7 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -106,6 +106,10 @@ class EnumMeta(type): raise ValueError('Invalid enum member name: {0}'.format( ','.join(invalid_names))) + # create a default docstring if one has not been provided + if '__doc__' not in classdict: + classdict['__doc__'] = 'An enumeration.' + # create our new Enum type enum_class = super().__new__(metacls, cls, bases, classdict) enum_class._member_names_ = [] # names in definition order -- cgit v1.2.1