8 Dec
2017
8 Dec
'17
12:30 p.m.
08.12.17 13:36, Antoine Pitrou пише:
On Fri, 8 Dec 2017 13:26:48 +0200 Serhiy Storchaka <storchaka@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__.