[Numpy-discussion] Ransom Proposals

Fernando Perez Fernando.Perez at colorado.edu
Sat Mar 25 17:50:07 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.

Mmh.  I bet many people will continue to use the functional interface for a 
long time.  I'd vote for uniform semantics before 1.0.  Really, the whole 
'reshape(foo) and foo.reshape() have different view/copy behavior' thing is 
horrible.  WAY too easy to forget/confuse.  Special cases are /almost never/ 
special enough to warrant this kind of extra mental overhead.

At least I know /I/ will forget, get confused, and make mistakes.  So I'd like 
to ask for as-uniform-as possible behavior.

Cheers,

f




More information about the Numpy-discussion mailing list