[docs] [issue36879] bug with round() and "numpy floats"

Mark Dickinson report at bugs.python.org
Sat May 11 06:28:53 EDT 2019


Mark Dickinson <dickinsm at gmail.com> added the comment:

> Maybe we should add something in the docs regarding the no-restriction point.

IMO, the docs are clear enough (and also long enough) already here. Just as with most other magic methods, classes from third-party packages can return whatever they like. It doesn't seem worth adding specific disclaimers about this everywhere that a magic method might be used. Otherwise, we should also add corresponding disclaimers about `__floor__`, `__ceil__`, `__trunc__`, `__pow__`, and so on, and I think that would just introduce an increase in documentation size without any overall increase in clarity or usefulness.

I'd prefer to stick to documenting that there _is_ a restriction where that's true (e.g., `__index__` or `__hash__`).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36879>
_______________________________________


More information about the docs mailing list