[Numpy-discussion] Shouldn't all in-place operations simply return self?
Thu Jan 17 12:29:08 CST 2013
On Thu, Jan 17, 2013 at 6:08 PM, Dag Sverre Seljebotn <
> In addition to the verb tense, I think it's important that mutators are
> methods whereas functions do not mutate their arguments:
Unfortunately this isn't really viable in a language like Python where you
can't add methods to a class. (list.sort() versus sorted() has as much or
more to do with the fact that sort's implementation only works on lists,
while sorted takes an arbitrary iterable.) Even core python provides a
function for in-place list randomization, not a method. Following the
proposed rule would just mean that we couldn't provide in-place shuffles at
all, which is clearly not going to be acceptable.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion