round() return type

Issue #26 open
created an issue

In Python 2.x, round() always returns float. In Python 3.x however, round() returns int when

second argument is ommited or

first argument is int (regardless of second argument).


type(round(1.5)) <class 'int'> type(round(1)) <class 'int'> type(round(1, 9)) <class 'int'> }}}

3to2 maps 3.x round() to 2.x round(), which sometimes results in broken code:

{{{ class foo(object): def init(self, x): self.x = x def int(self): return round(self.x)

int(foo(1.5)) }}}

Comments (2)

  1. Log in to comment