Skip to content

Explicitly setting () and repeat=1 to itertools.product() doesn't return () #139880

@hyperkai

Description

@hyperkai

Bug report

Bug description:

The doc of itertools.product() say below so the default value of *iterables is () and the default value of repeat is 1:

itertools.product(*iterables, repeat=1)

Then, setting no arguments to itertools.product() returns () as shown below:

from itertools import product

v = product()

print(next(v)) # ()
print(next(v)) # StopIteration:

But explicitly setting () and repeat=1 to itertools.product() doesn't return () as shown below:

from itertools import product

v = product((), repeat=1)

print(next(v)) # StopIteration:

So, explicitly setting () and repeat=1 to itertools.product() should return ().

CPython versions tested on:

3.12

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