This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients Scaler, pablogsal
Date 2019-05-10.22:12:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557526355.9.0.424205584653.issue36879@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-05-10 22:12:35pablogsalsetrecipients: + pablogsal, Scaler
2019-05-10 22:12:35pablogsalsetmessageid: <1557526355.9.0.424205584653.issue36879@roundup.psfhosted.org>
2019-05-10 22:12:35pablogsallinkissue36879 messages
2019-05-10 22:12:35pablogsalcreate