On Thu, Jan 17, 2013 at 6:08 PM, Dag Sverre Seljebotn <
d.s.seljeb...@astro.uio.no> wrote:
> In addition to the verb tense, I think it's important that mutators are
> methods whereas functions do not mutate their arguments:
>
> lst.sort()
> sorted(lst)

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.

-n
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to