Skip to content

enum.Flag.__iter__() is marked as "changed" in Python 3.11, but it's actually new #115106

Closed
@finite-state-machine

Description

@finite-state-machine

Documentation

Doc/library/enum.rst near line 537 reads:
screenshot ending with "Changed in version 3.11..."

Flag.__iter__() is new in Python 3.11, as already noted in typeshed and as may be verified using the following script:

from __future__ import annotations
from enum import (
        auto,
        Flag,
        )

class SomeFlag(Flag):

    A = auto()
    B = auto()
    C = auto()

if __name__ == '__main__':

    combined = SomeFlag.A | SomeFlag.B | SomeFlag.C
    # this works in Python 3.11, but not in Python 3.10 (no '__iter__()'
    # method)
    for flag in combined:
        print(flag)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions