Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-19 Thread eat
Hi, On Fri, Jan 18, 2013 at 12:13 AM, Thouis (Ray) Jones tho...@gmail.comwrote: On Thu, Jan 17, 2013 at 10:27 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jan 16, 2013 at 5:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-18 Thread Ralf Gommers
On Thu, Jan 17, 2013 at 11:13 PM, Thouis (Ray) Jones tho...@gmail.comwrote: On Thu, Jan 17, 2013 at 10:27 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jan 16, 2013 at 5:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Jim Vickroy
On 1/16/2013 11:41 PM, Nathaniel Smith wrote: On 16 Jan 2013 17:54, josef.p...@gmail.com mailto:josef.p...@gmail.com wrote: a = np.random.random_integers(0, 5, size=5) b = a.sort() b a array([0, 1, 2, 5, 5]) b = np.random.shuffle(a) b b = np.random.permutation(a) b

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Alan G Isaac
Is it really better to have `permute` and `permuted` than to add a keyword? (Note that these are actually still ambiguous, except by convention.) Btw, two separate issues seem to be running side by side. i. should in-place operations return their result? ii. how can we signal that an operation

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Benjamin Root
On Thu, Jan 17, 2013 at 8:54 AM, Jim Vickroy jim.vick...@noaa.gov wrote: On 1/16/2013 11:41 PM, Nathaniel Smith wrote: On 16 Jan 2013 17:54, josef.p...@gmail.com wrote: a = np.random.random_integers(0, 5, size=5) b = a.sort() b a array([0, 1, 2, 5, 5]) b =

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread josef . pktd
On Thu, Jan 17, 2013 at 9:49 AM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Jan 17, 2013 at 8:54 AM, Jim Vickroy jim.vick...@noaa.gov wrote: On 1/16/2013 11:41 PM, Nathaniel Smith wrote: On 16 Jan 2013 17:54, josef.p...@gmail.com wrote: a = np.random.random_integers(0, 5, size=5) b

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Charles R Harris
On Wed, Jan 16, 2013 at 5:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread http://article.gmane.org/gmane.comp.python.numeric.general/52772 it was proposed that .fill(.) should return self as an alternative for a trivial two-liner. I'm raising now the question: what if

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread josef . pktd
On Thu, Jan 17, 2013 at 10:24 AM, josef.p...@gmail.com wrote: On Thu, Jan 17, 2013 at 9:49 AM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Jan 17, 2013 at 8:54 AM, Jim Vickroy jim.vick...@noaa.gov wrote: On 1/16/2013 11:41 PM, Nathaniel Smith wrote: On 16 Jan 2013 17:54,

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Nathaniel Smith
On Thu, Jan 17, 2013 at 2:32 PM, Alan G Isaac alan.is...@gmail.com wrote: Is it really better to have `permute` and `permuted` than to add a keyword? (Note that these are actually still ambiguous, except by convention.) The convention in question, though, is that of English grammar. In

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Dag Sverre Seljebotn
On 01/17/2013 05:33 PM, Nathaniel Smith wrote: On Thu, Jan 17, 2013 at 2:32 PM, Alan G Isaac alan.is...@gmail.com wrote: Is it really better to have `permute` and `permuted` than to add a keyword? (Note that these are actually still ambiguous, except by convention.) The convention in

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Nathaniel Smith
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

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Thouis (Ray) Jones
On Thu, Jan 17, 2013 at 10:27 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jan 16, 2013 at 5:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread http://article.gmane.org/gmane.comp.python.numeric.general/52772 it was proposed that .fill(.) should return self

[Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-16 Thread eat
Hi, In a recent thread http://article.gmane.org/gmane.comp.python.numeric.general/52772 it was proposed that .fill(.) should return self as an alternative for a trivial two-liner. I'm raising now the question: what if all in-place operations indeed could return self? How bad this would be? A

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-16 Thread josef . pktd
On Wed, Jan 16, 2013 at 7:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread http://article.gmane.org/gmane.comp.python.numeric.general/52772 it was proposed that .fill(.) should return self as an alternative for a trivial two-liner. I'm raising now the question: what if all

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-16 Thread Nathaniel Smith
On 16 Jan 2013 17:54, josef.p...@gmail.com wrote: a = np.random.random_integers(0, 5, size=5) b = a.sort() b a array([0, 1, 2, 5, 5]) b = np.random.shuffle(a) b b = np.random.permutation(a) b array([0, 5, 5, 2, 1]) How do I remember if shuffle shuffles or permutes ? Do we