Skip to content

Inconsistent behavior with list(reduce(...)) #8861

Open
@rafalslaby

Description

@rafalslaby
from functools import reduce

tmp = reduce(lambda x, y: x + y, [[1], [2]])
# this works fine
result = list(tmp) 

# but this one produces an error:
#  Unsupported left operand type for + ("Iterable[int]")
result = list(reduce(lambda x, y: x + y, [[1], [2]]))
$ mypy --version
mypy 0.770

Python version:

>>> sys.version
'3.8.2 (default, May 20 2020, 18:13:32) \n[GCC 7.5.0]'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions