[Python-Dev] Return type of round, floor, and ceil in 2.6 (original) (raw)

Jeffrey Yasskin jyasskin at gmail.com
Thu Jan 3 08:52:46 CET 2008


I've been backporting pep 3141 to the trunk, and ran into the issue that round, math.floor, and math.ceil, which it specifies to return Integrals, currently return floats. Guido suggested privately that, to make sure that 2.6 is compatible with 2.5, they should keep returning floats for float arguments. Probably this implies that they should also keep returning float for int and long arguments.

For other types, we're probably free to do whatever. Consistency across all Real implementations suggests that those 3 functions should always return their argument type. Consistency and compatibility with 3.0 suggest that they should return long for every new type we add them to. What does the list think?

Thanks, Jeffrey Yasskin



More information about the Python-Dev mailing list