mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
In Python 3, the ndigits argument of round() defaults to None. If ndigits is excluded or explicitly None, the result is always an int. If ndigits is not None, the result should be the same type as the number. $ cat test.py from fractions import Fraction print(type(round(0.1))) print(type(round(0.1, None))) print(type(round(0.1, 0))) print(type(round(Fraction(1, 10)))) print(type(round(Fraction(1, 10), None))) print(type(round(Fraction(1, 10), 0))) $ python3 ./test.py <class 'int'> <class 'int'> <class 'float'> <class 'int'> <class 'int'> <class 'fractions.Fraction'> Update the signatures to allow for an ndigits of None.