[Numpy-discussion] long(a) vs a.__long__() for scalar arrays

David Cournapeau cournape@gmail....
Tue Feb 23 22:27:53 CST 2010

On Wed, Feb 10, 2010 at 3:12 PM, David Cournapeau <cournape@gmail.com> wrote:
> Hi,
> I am a bit puzzled by the protocol for long(a) where a is a scalar
> array. For example, for a = np.float128(1), I was expecting long(a) to
> call a.__long__, but it does not look like it is the case. int(a) does
> not call a.__int__ either. Where does the long conversion happen in
> numpy for scalar arrays ?

For the record, this happens in the PyNumber machinery (the exact C
function doing it is longdouble_long in scalarmath module).



More information about the NumPy-Discussion mailing list