Re: [sage-devel] Re: questions about option: inplace vs copy

2015-09-01 Thread Samuel Lelievre
2015-08-22 13:40:51 UTC+2, Johan S. R. Nielsen: > > > About the naming of the copying form versus in-place form, note that matrices currently have e.g. echelon_form/echelonize and hessenberg_form/hessenbergize. Standardisation would > dictate echeloned or echelon_formed? > Maybe echelonize/ech

Re: [sage-devel] Re: questions about option: inplace vs copy

2015-08-24 Thread Jori Mäntysalo
On Mon, 24 Aug 2015, Volker Braun wrote: What would be the benefit over  M2 = M**2 M2.set_immutable() other than a more cumbersome syntax that requires you to look up the __mul__ docstring to use it?  Speed? I don't know, this is a real question. I just thinked about difference between mat

Re: [sage-devel] Re: questions about option: inplace vs copy

2015-08-24 Thread Volker Braun
On Monday, August 24, 2015 at 2:51:46 AM UTC-4, Jori Mäntysalo wrote: > > For example if M is an immutable matrix, would it give more speed to have > something like M.__mul__(M, immutable=True)? What would be the benefit over M2 = M**2 M2.set_immutable() other than a more cumbersome syntax t

Re: [sage-devel] Re: questions about option: inplace vs copy

2015-08-23 Thread Jori Mäntysalo
Is there a convention for functions returning larger objects? For example if M is an immutable matrix, would it give more speed to have something like M.__mul__(M, immutable=True)? -- Jori Mäntysalo

Re: [sage-devel] Re: questions about option: inplace vs copy

2015-08-22 Thread Johan S . R . Nielsen
Basically +1 for Volker's suggestion. Vincent's suggestion on the semantics of "copy" in constructors seem very dangerous: even if my construction of MyNewObject works today, a seemingly unrelated change to either the caller code or MyNewObject tomorrow could completely break things in highly surpr

[sage-devel] Re: questions about option: inplace vs copy

2015-08-21 Thread Volker Braun
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 versati

[sage-devel] Re: questions about option: inplace vs copy

2015-08-21 Thread Vincent Delecroix
Hello Vincent, I do actually prefer to keep both with different semantics (so I guess it is answer 5.). - "inplace" should be used when the object is being modified within a method (i.e. G.cut_me_in_pieces(inplace=True) will modify G) - "copy" should be used when we want to specify whether