[SciPy-dev] 32bit vs 64bit doctest differences

Stefan van der Walt stefan@sun.ac...
Fri Jan 18 01:51:34 CST 2008


Hi Nathan

On Mon, Jan 14, 2008 at 02:15:10PM -0600, Nathan Bell wrote:
> It appears that numpy prints the 'dtype=intXX' part only when the size
> of int differs from the machine word size.  For example, consider the
> following test run on a 64-bit machine:
> 
> File "/usr/lib/python2.5/site-packages/scipy/stsci/convolve/Convolve.py",
> line 295, in scipy.stsci.convolve.Convolve.boxcar
> Failed example:
>     boxcar(num.array([10, 0, 0, 0, 0, 0, 1000]), (3,),
> mode="wrap").astype(num.longlong)
> Expected:
>     array([336,   3,   0,   0,   0, 333, 336], dtype=int64)
> Got:
>     array([336,   3,   0,   0,   0, 333, 336])
> 
> 
> Should we just use dtype=int to avoid this issue?  It appears
> dtype=int chooses the native size.

This situation does make tests more difficult to write.  We can't use
"int", because then interpreting x.__repr__ wont necessarily give x.
Why don't we always print the dtype, whether it is an int32, int64,
float32 or float64?

Regards
Stéfan


More information about the Scipy-dev mailing list