08.12.17 13:36, Antoine Pitrou пише:
On Fri, 8 Dec 2017 13:26:48 +0200
Serhiy Storchaka <storch...@gmail.com>
wrote:
Currently the following functions fall back on __int__ where available:
PyLong_AsLong
PyLong_AsLongAndOverflow
PyLong_AsLongLong
PyLong_AsLongLongAndOverflow
PyLong_AsUnsignedLongMask
PyLong_AsUnsignedLongLongMask
I think this should be deprecated (and there should be an open issue for
this). Calling __int__ is just a Python 2 legacy.
I think that's a bad idea. There are widely-used int-like classes out
there and it will break actual code:
import numpy as np
x = np.int64(5)
isinstance(x, int)
False
x.__int__()
5
NumPy integers implement __index__.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/