Closed
Description
I have been trying mypy out, and I am hitting something I don't understand. I have the following line of code:
NZD = Currency(name='New Zealand Dollars', abbreviation='NZD', slice=slice(3, None, None), format='NZ${price:.2f}')
When I run mypy over it I get the following error (in python3.5 virtualenv):
mypy --strict-optional -p lists
lists\constants.py:13: error: Argument 2 to "slice" has incompatible type None; expected "int"
It seems that slice has a type signature of slice(int, int, int), but to get the behavior I want (give me everything in the string after the third character) I need to pass in a None. I think they should be Optional[int]s rather than ints.
Hopefully that makes sense.
Metadata
Metadata
Assignees
Labels
No labels