[Numpy-discussion] Array printing differences between 64- and 32-bit platforms

Ken Basye kbasye1@jhu....
Wed Oct 15 11:52:56 CDT 2008


Hi Folks,
  In porting some code to a 64-bit machine, I ran across the following 
issue. 
On the 64-bit machine, an array with dtype=int32 prints the dtype 
explicitly, whereas on
a 32 bit machine it doesn't.  The same is true for dtype=intc (since 
'intc is int32' --> True),
and the converse is true for dtype=int64 and dtype=longlong.  Arrays 
with dtype of plain int
both print without the dtype, but then you're not using the same 
underlying size anymore.
  I think this is handled in core/numeric.py in array_repr and just 
above, where certain types
are added to _typelessdata if they are subclasses of 'int'.  The 
issubclass test returns different values
on platforms with different word lengths.
  This difference can make doctests fail and although there are doctest 
tricks to prevent the failure,
they're a bit annoying to use.  I was wondering about introducing a new 
print setting that forced
dtypes to be printed always.   Is there any support for that? 
  Any other ideas would also be most welcome.

    Thanks,
        Ken Basye


More information about the Numpy-discussion mailing list