[Numpy-discussion] Ransom Proposals

Tim Hochberg tim.hochberg at cox.net
Sat Mar 25 22:35:02 CST 2006


Sasha wrote:

>On 3/25/06, Tim Hochberg <tim.hochberg at cox.net> wrote:
>  
>
>>...
>>However, if reshape does not return a view, let's say obj is a list, it
>>will fail. And not *just* fail, it will fail silently. There are obvious
>>ways to fix this program (set obj.shape instead of using reshape, for
>>example), but the fewer perils I need to remember the better.
>>    
>>
>
>Or, you can use the reshape method instead of function.  I believe
>numpy advocates use of methods instead of functions.  What you observe
>is just another reason for that.  Since functions like reshape remain
>in numpy primarily for backwards compatibility, I would be against any
>change in semantics.
>  
>

That's not unreasonable. How would you feel about relegating reshape and 
transpose and whatever else is found to have this unfortunate 
characteristics to a backwards compatibility module so that old code can 
use it, but new code would not see it.

That brings up another question: is the plan to keep oldnumeric around 
forever, or is it going away eventually? If it is going away, then the 
place to put these would be oldnumeric. Actually, it's OK if it sticks 
around as long as it doesn't end up in the numpy namespace by default.

I agree with Fernando: I don't have a specific behaviour that I'm 
looking for in these as long as it's consistent. Just leaving it alone, 
but deprecating it and shunting it off to a compatibility module would 
be fine. Fine, as long as x.reshape behaves sensibly: does it always 
return a view? You (Sasha) said something about it maybe sometimes 
returning a copy. If so, that should be fixed.

-tim





More information about the Numpy-discussion mailing list