Skip to content

About permutations(), setting the longer length than iterable argument to r argument returns nothing, error should be returned for this #135451

Closed as not planned
@hyperkai

Description

@hyperkai

Bug report

Bug description:

About permutations(), setting the longer length than iterable argument to r argument returns nothing as shown below. *In this example, setting 1, 2 and 3 to r argument returns values:

from itertools import permutations

for x in permutations(iterable='ABC', r=4):
    print(x)
# Nothing

So for this, the error like below should be returned:

ValueError: r must be 0 <= x < = iterable length

from itertools import permutations

for x in permutations(iterable='ABC', r=4):
    print(x)
# Nothing

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions