[Numpy-discussion] Ransom Proposals
Colin J. Williams
cjw at sympatico.ca
Sun Mar 26 06:17:03 EST 2006
Fernando Perez wrote:
> 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.
>
+1
Perhaps most of the functions could be in a compatibility module, which
the user would import as needed, with most cases defined as something like:
reshape(arr, d1, d2, ...)= numpy.ndarray.reshape(arr,d1, d2, ...)
Colin W.
> Cheers,
>
> f
>
More information about the NumPy-Discussion
mailing list