On Sat, Oct 20, 2012 at 10:05 PM, Fernando Perez wrote:
> Note that you don't need to explicitly call repr() at the interactive
> prompt: by default, Python prints the repr of an object when you type
> its name:
True, and good point to notice. Nevertheless print executes str(), if
present, and it
On Sat, Oct 20, 2012 at 4:40 AM, Daπid wrote:
a=np.arange(10)
print a
> [0 1 2 3 4 5 6 7 8 9]
repr(a)
> 'array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])'
>
Note that you don't need to explicitly call repr() at the interactive
prompt: by default, Python prints the repr of an object when you t
For the case of a small array, you can use repr(). This will work as
long as the array is not clipped (it is small enough).
>>> a=np.arange(10)
>>> print a
[0 1 2 3 4 5 6 7 8 9]
>>> repr(a)
'array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])'
>>> a=np.arange(1)
>>> a.resize((100,100))
>>> print a
[[ 0
I find it annoying that in casual use, if I print an array, that form can't be
directly used as subsequent input (or can it?).
What do others do about this? When I say casual, what I mean is, I write some
long-running task and at the end, print some small array. Now I decide I'd
like
to cut/