IMHO both foo(copy=True) and foo(inplace=False) are fugly and best avoided. 
They are unintuitive and not discoverable. Basically they are patterns for 
an API that you can only use by constantly looking up the documentation. 

If possible, methods should act in-place since that is the most versatile 
(you cannot un-copy, but you can easily make a copy before acting). So that 
should always be the default. Of course if the object can be immutable then 
you can't act in-place. Use past tense to name the copying form of the 
method. 

E.g. list.sort() vs. sorted(). 

* The in-place operation is more useful and therefore the list method
* The -ed implies copy.

In constructors its best to make copies of mutable data and reference 
immutable data. Just do the right thing, don't trick the user into 
introducing subtle errors MyNewObject(data_list, copy=False) or 
unnecessarily waste memory MyNewObject(data_tuple, copy=True).



On Friday, August 21, 2015 at 2:08:45 PM UTC-4, vdelecroix wrote:
>
> Hello, 
>
> While looking at #18481, I realized that we have two argument names that 
> have the same purpose: "copy" and "inplace" (one being the contrary of 
> the other of course). As it is worth a convention, I am just asking for 
> your preferences: 
>   1. It does not matter 
>   2. Functions should accept both, ie both my_function(copy=True) and 
> my_function(inplace=True) should work 
>   2. "inplace" is better 
>   3. "copy" is better 
>   4. we need another argument name 
>   5. ? 
>
> Best, 
> Vincent 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to