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

Charles R Harris charlesr.harris at gmail.com
Wed Oct 15 16:08:02 EDT 2008


On Wed, Oct 15, 2008 at 10:52 AM, Ken Basye <kbasye1 at jhu.edu> wrote:

> 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.
>

I'm inclined to say always print the type, but that is a behavior change and
might break some current code. I'm not sure how we should handle small
fixups like that.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081015/292c6c3f/attachment.html>


More information about the NumPy-Discussion mailing list