Message342140
round() delegates to class.__round__, so what's happening here is that numpy's float implements __round__ in a way it returns a float.
There is no restriction on what the class can return:
>>> class A:
... def __round__(self):
... return "Oh, no!"
...
>>> round(A())
'Oh, no!'
Making additional restrictions is backwards incompatible. Maybe we should add something in the docs regarding the no-restriction point. |
|
Date |
User |
Action |
Args |
2019-05-10 22:12:35 | pablogsal | set | recipients:
+ pablogsal, Scaler |
2019-05-10 22:12:35 | pablogsal | set | messageid: <1557526355.9.0.424205584653.issue36879@roundup.psfhosted.org> |
2019-05-10 22:12:35 | pablogsal | link | issue36879 messages |
2019-05-10 22:12:35 | pablogsal | create | |
|