Skip to content

Unsupported operand types using += with floats initialized to 0 (not 0.0) #1193

Open
@timabbott

Description

@timabbott

mypy complains with:
/home/tabbott/foo.py:4: error: Unsupported operand types for + ("int" and "float") with the following code:

foo = 0
foo += 0.5

While one can work around this by initializing to 0.0, it seems worth thinking about if mypy should accept this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions