Reputation: 2420
Considering the following program:
from decimal import Decimal
from typing import Union
def foo(bar: Union[Decimal, int]):
print(Decimal(1) + bar)
print(bar + Decimal(1))
Why does mypy
complain in the second print()?
$ mypy foo.py
foo.py: note: In function "foo":
foo.py:6: error: Unsupported operand types for + ("Union[Decimal, int]" and "Decimal")
I'm using mypy 0.3.1 on Python 3.5.1, Ubuntu 16.04.
EDIT: This seems to be a bug in mypy.
Upvotes: 2
Views: 842