diff -r 828c9b920532 Doc/library/enum.rst --- a/Doc/library/enum.rst Fri Nov 13 15:18:26 2015 +0200 +++ b/Doc/library/enum.rst Fri Nov 13 10:17:02 2015 -0800 @@ -724,31 +724,34 @@ The most interesting thing about Enum me :class:`EnumMeta` creates them all while it is creating the :class:`Enum` class itself, and then puts a custom :meth:`__new__` in place to ensure that no new ones are ever instantiated by returning only the existing member instances. Finer Points ^^^^^^^^^^^^ Enum members are instances of an Enum class, and even though they are -accessible as `EnumClass.member`, they are not accessible directly from +accessible as `EnumClass.member`, they may not be accessible directly from the member:: - >>> Color.red - - >>> Color.red.blue - Traceback (most recent call last): + >>> class FieldTypes(Enum): + ... name = 0 + ... value = 1 + ... size = 2 ... - AttributeError: 'Color' object has no attribute 'blue' + >>> FieldTypes.value.size + + >>> FieldTypes.size.value + 2 -Likewise, the :attr:`__members__` is only available on the class. +The :attr:`__members__` attribtute is only available on the class. If you give your :class:`Enum` subclass extra methods, like the `Planet`_ class above, those methods will show up in a :func:`dir` of the member, but not of the class:: >>> dir(Planet) ['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__'] >>> dir(Planet.EARTH) ['__class__', '__doc__', '__module__', 'name', 'surface_gravity', 'value']