[Numpy-discussion] Formatting uint64 number

Thomas Robitaille thomas.robitaille@gmail....
Sun Nov 1 21:37:05 CST 2009


Hello,

I have a question concerning uint64 numbers - let's say I want to  
format a uint64 number that is > 2**31, at the moment it's necessary  
to wrap the numpy number inside long before formatting

In [3]: "%40i" % np.uint64(2**64-1)
Out[3]: '                                      -1'

In [4]: "%40i" % long(np.uint64(2**64-1))
Out[4]: '                    18446744073709551615'

Would it be easy to modify numpy such that it automatically converts  
uint64 numbers to long() instead of int() when implicitly converted to  
python types?

Thanks,

Thomas


More information about the NumPy-Discussion mailing list