[Python-checkins] Improve enum.Flag code example (GH-5167)

Mariatta webhook-mailer at python.org
Fri Jan 12 22:36:00 EST 2018


https://github.com/python/cpython/commit/0f31c74fcfdec8f9e6157de2c366f2273de81677
commit: 0f31c74fcfdec8f9e6157de2c366f2273de81677
branch: master
author: Julian Kahnert <mail at juliankahnert.de>
committer: Mariatta <Mariatta at users.noreply.github.com>
date: 2018-01-12T19:35:57-08:00
summary:

Improve enum.Flag code example (GH-5167)

The code example that demonstrate how to use enum.Flag was missing
the import of enum.auto.

files:
M Doc/library/enum.rst

diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 6548adf789d..5c1b226efc7 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -654,7 +654,7 @@ value and let :class:`Flag` select an appropriate value.
 Like :class:`IntFlag`, if a combination of :class:`Flag` members results in no
 flags being set, the boolean evaluation is :data:`False`::
 
-    >>> from enum import Flag
+    >>> from enum import Flag, auto
     >>> class Color(Flag):
     ...     RED = auto()
     ...     BLUE = auto()



More information about the Python-checkins mailing list