Skip to content

The doc of set().pop() should say *the 1st element* instead of *an arbitrary element* #137745

@hyperkai

Description

@hyperkai

The doc of set().pop() says arbitrary element as shown below:

Remove and return an arbitrary element from the set. ...

But set().pop() always removes and returns the 1st element in the set as shown below:

v = set({'A', 'B', 'C', 'D', 'E'})

print(v)
# {'E', 'D', 'B', 'A', 'C'}

print(v.pop()) # E
print(v.pop()) # D
print(v.pop()) # B
print(v.pop()) # A
print(v.pop()) # C
v = set({0, 1, 2, 3, 4})

print(v)
# {0, 1, 2, 3, 4}

print(v.pop()) # 0
print(v.pop()) # 1
print(v.pop()) # 2
print(v.pop()) # 3
print(v.pop()) # 4

The doc of set().pop() should say the 1st element as shown below:

Remove and return the 1st element from the set. ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions