This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `enum.auto()` incrementation value not specified.
Type: Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: YoSTEALTH, docs@python, eric.smith, ethan.furman, miss-islington, ned.deily
Priority: normal Keywords: patch

Created on 2020-01-06 19:10 by YoSTEALTH, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17872 merged YoSTEALTH, 2020-01-06 19:13
PR 17875 merged miss-islington, 2020-01-06 19:53
PR 17876 merged miss-islington, 2020-01-06 19:53
PR 17878 merged YoSTEALTH, 2020-01-06 20:39
Messages (7)
msg359452 - (view) Author: (YoSTEALTH) * Date: 2020-01-06 19:10
# enum in C
# ---------
enum {
    a,
    b,
    c
}
# a = 0
# b = 1
# b = 2

# enum in Python
# --------------
class Count(enum.IntEnum):
    a = enum.auto()
    b = enum.auto()
    c = enum.auto()
# a = 1
# b = 2
# b = 3


I am not sure why the `enum.auto()` starts with 1 in Python but this has just wasted a week worth of my time.
msg359461 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-01-06 19:48
`auto()` starts with 1 because Enum numbering starts at 1 (which is in the docs, albeit buried in the Functional API section).

Thank you for your effort to save somebody else from that frustration, though, I appreciate it.
msg359463 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-01-06 19:53
New changeset 2e9012a3e1e316c54e27f51ba5849ba06eab7da2 by Ethan Furman (YoSTEALTH) in branch 'master':
bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872)
https://github.com/python/cpython/commit/2e9012a3e1e316c54e27f51ba5849ba06eab7da2
msg359472 - (view) Author: miss-islington (miss-islington) Date: 2020-01-06 22:04
New changeset 24bcefcb74231476b055bb6f0726642abeb10f04 by Miss Islington (bot) (YoSTEALTH) in branch 'master':
bpo-39234: `enum.auto()` default initial value as 1 (GH-17878)
https://github.com/python/cpython/commit/24bcefcb74231476b055bb6f0726642abeb10f04
msg359487 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-01-07 01:45
Thanks for the PRs.
msg360705 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-01-25 19:40
New changeset eec7636bfd07412b5872c0683636e9e98bf79a8c by Ned Deily (Miss Islington (bot)) in branch '3.8':
bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872) (GH-17875)
https://github.com/python/cpython/commit/eec7636bfd07412b5872c0683636e9e98bf79a8c
msg360706 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-01-25 19:41
New changeset b0a6ec256b460f071e33b4633e5bec450d8e6394 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872) (GH-17876)
https://github.com/python/cpython/commit/b0a6ec256b460f071e33b4633e5bec450d8e6394
History
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83415
2020-01-25 19:41:57ned.deilysetversions: - Python 3.6
2020-01-25 19:41:28ned.deilysetmessages: + msg360706
2020-01-25 19:40:31ned.deilysetnosy: + ned.deily
messages: + msg360705
2020-01-07 01:45:39eric.smithsetstatus: open -> closed

nosy: + eric.smith
messages: + msg359487

resolution: fixed
stage: patch review -> resolved
2020-01-06 22:04:46miss-islingtonsetnosy: + miss-islington
messages: + msg359472
2020-01-06 20:39:54YoSTEALTHsetpull_requests: + pull_request17294
2020-01-06 19:53:58miss-islingtonsetpull_requests: + pull_request17292
2020-01-06 19:53:52miss-islingtonsetpull_requests: + pull_request17291
2020-01-06 19:53:40ethan.furmansetmessages: + msg359463
2020-01-06 19:48:04ethan.furmansetnosy: + ethan.furman
messages: + msg359461
2020-01-06 19:13:06YoSTEALTHsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17288
2020-01-06 19:10:39YoSTEALTHcreate