[Numpy-discussion] Array printing differences between 64- and 32-bit platforms
Charles R Harris
Wed Oct 15 15:08:02 CDT 2008
On Wed, Oct 15, 2008 at 10:52 AM, Ken Basye <firstname.lastname@example.org> wrote:
> Hi Folks,
> In porting some code to a 64-bit machine, I ran across the following
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion