3 ms·
> I basically can't figure a way to annotate a function that takes an int/float/decimal/etc. It seems like you should be able to just annotate it with float?
by yorwba 9y ago
> I basically can't figure a way to annotate a function that takes an int/float/decimal/etc.
It seems like you should be able to just annotate it with float?
... when an argument is annotated as having type float , an argument of type int is acceptable ...
https://www.python.org/dev/peps/pep-0484/#the-numeric-tower https://www.python.org/dev/peps/pep-0484/#the-numeric-tower
- deathanatos 9y agoHmm. I wasn't aware of that; still, it seems to not work for Decimal objects.