Keith Goodman wrote:
> On Fri, Aug 29, 2008 at 10:51 AM, Keith Goodman <[EMAIL PROTECTED]> wrote:
>   
>> On Fri, Aug 29, 2008 at 10:42 AM, dmitrey <[EMAIL PROTECTED]> wrote:
>>     
>>> Keith Goodman wrote:
>>>       
>>>> Yeah, I do stuff like that too. fill works in place so it returns None.
>>>>
>>>>
>>>>         
>>>>>> x = np.array([1,2])
>>>>>> x.fill(10)
>>>>>> x
>>>>>>
>>>>>>             
>>>>    array([10, 10])
>>>>
>>>>         
>>>>>> x = x.fill(10)  # <-- Danger!
>>>>>> print x
>>>>>>
>>>>>>             
>>>> None
>>>>
>>>>         
>>> Since result "None" is never used it would be better to return reference
>>> to the modified array, ...
>>>       
>> I like that idea. A lot of numpy functions return a reference to the
>> modified array when the output array (out) is specified.
>>     
>
> But python doesn't do that. For example, x.sort() returns None in
> python. Should it return None in numpy?
>   
I think the value "None" that any method always returns is hardly used 
by anyone, so backward compatibility will not suffer much. Since 
in-place modification remains (along with new-style returning value that 
is reference to the array), there should be no backward 
incompatibilities at all.
D.
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to