[Numpy-discussion] Ransom Proposals
Travis Oliphant
oliphant at ee.byu.edu
Mon Mar 27 13:43:04 CST 2006
Tim Hochberg wrote:
>>
>> Yes, having this ability means that you have to think about it a bit
>> if you are going to use the functional interface and try to do
>> in-place operations. But, I would argue that this is an "advanced"
>> usage which is implemented to save space and time.
>
>
> How is this true though? In what way, for instance, is:
>
> b = asarray(a).reshape(newshape)
>
> slower or less space efficient than todays:
>
> b = reshape(a)
Well, the big difference is that b=reshape(a) is actually
try:
reshape = a.reshape
except AttributeError:
return a.__array_wrap__(asarray(a).reshape(newshape))
return reshape(newshape)
So, it handles more cases, more cleanly then the
asarray(a).rehsape(newshape) approach does.
-Travis
More information about the Numpy-discussion
mailing list