[Numpy-discussion] repr for numarray
gball at cfa.harvard.edu
Tue Jun 11 12:25:08 EDT 2002
> 1) Do what is done now, always print a string that when
> eval'ed will recreate the array.
> 2) Only give summary information for the array regardless of
> its size.
> 3) Print the array if it has fewer than THRESHOLD number of
> elements, otherwise print a summary. THRESHOLD may be adjusted
> by the user.
I vote for 3) too.
Especially annoying is when I mistakenly type a.shape instead of a.shape()
interactively. Without the parentheses I get a bound method, the repr of
which includes the repr for the whole array, and when this has > 25
million elements it really is a drag to wait for it all to finish spewing
Getting sidetracked... is this repr of methods a feature?
>>> l = [1,2,3,4]
<built-in method sort of list object at 0x402d4eec>
>>> a = numarray.array(l)
<bound method NumArray.shape of array([1, 2, 3, 4])>
It would seem more pythonic to get
<bound method NumArray.shape of array object at 0x402d4bcc>
More information about the NumPy-Discussion