Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread josef.pktd
On Wed, Feb 17, 2016 at 7:17 PM, Juan Nunez-Iglesias wrote: > Ah! Touché! =) My last and admittedly weak defense is that I've been > writing numpy since before 1.7. =) > > On Thu, Feb 18, 2016 at 11:08 AM, Alan Isaac wrote: > >> On 2/17/2016 7:01 PM, Juan Nunez-Iglesias wrote: >> >>> Notice the

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Juan Nunez-Iglesias
Ah! Touché! =) My last and admittedly weak defense is that I've been writing numpy since before 1.7. =) On Thu, Feb 18, 2016 at 11:08 AM, Alan Isaac wrote: > On 2/17/2016 7:01 PM, Juan Nunez-Iglesias wrote: > >> Notice the limitation "1D array-like". >> > > > > http://docs.scipy.org/doc/numpy-1.

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
On 2/17/2016 7:01 PM, Juan Nunez-Iglesias wrote: Notice the limitation "1D array-like". http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.random.choice.html "If an int, the random sample is generated as if a was np.arange(n)" hth, Alan Isaac ___

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Juan Nunez-Iglesias
Notice the limitation "1D array-like". On Thu, Feb 18, 2016 at 10:59 AM, Alan Isaac wrote: > On 2/17/2016 6:48 PM, Juan Nunez-Iglesias wrote: > >> Also fwiw, I think the 0-based, half-open interval is one of the best >> features of Python indexing and yes, I do use random integers to index >> in

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
On 2/17/2016 6:48 PM, Juan Nunez-Iglesias wrote: Also fwiw, I think the 0-based, half-open interval is one of the best features of Python indexing and yes, I do use random integers to index into my arrays and would not appreciate having to litter my code with "-1" everywhere. http://docs.scipy

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Robert Kern
He was talking consistently about "random integers" not "random_integers()". :-) On Wednesday, 17 February 2016, G Young wrote: > Your statement is a little self-contradictory, but in any case, you > shouldn't worry about random_integers getting removed from the code-base. > However, it has been

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Juan Nunez-Iglesias
LOL "random integers" != "random_integers". =D On Thu, Feb 18, 2016 at 10:52 AM, G Young wrote: > Your statement is a little self-contradictory, but in any case, you > shouldn't worry about random_integers getting removed from the code-base. > However, it has been deprecated in favor of randint.

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Your statement is a little self-contradictory, but in any case, you shouldn't worry about random_integers getting removed from the code-base. However, it has been deprecated in favor of randint. On Wed, Feb 17, 2016 at 11:48 PM, Juan Nunez-Iglesias wrote: > Also fwiw, I think the 0-based, half-o

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Juan Nunez-Iglesias
Also fwiw, I think the 0-based, half-open interval is one of the best features of Python indexing and yes, I do use random integers to index into my arrays and would not appreciate having to litter my code with "-1" everywhere. On Thu, Feb 18, 2016 at 10:29 AM, Alan Isaac wrote: > On 2/17/2016 3

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
On 2/17/2016 3:42 PM, Robert Kern wrote: random.randint() was the one big exception, and it was considered a mistake for that very reason, soft-deprecated in favor of random.randrange(). randrange also has its detractors: https://code.activestate.com/lists/python-dev/138358/ and following. I

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Sebastian Berg
On Mi, 2016-02-17 at 21:53 +, G Young wrote: > "Explicit is better than implicit" - can't argue with that. It > doesn't seem like the PR has gained much traction, so I'll close it. > Thanks for the effort though! Sometimes we get a bit carried away with doing fancy stuff, and I guess the ide

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
"Explicit is better than implicit" - can't argue with that. It doesn't seem like the PR has gained much traction, so I'll close it. On Wed, Feb 17, 2016 at 9:27 PM, Sebastian Berg wrote: > On Mi, 2016-02-17 at 22:10 +0100, Sebastian Berg wrote: > > On Mi, 2016-02-17 at 20:48 +, Robert Kern

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Sebastian Berg
On Mi, 2016-02-17 at 22:10 +0100, Sebastian Berg wrote: > On Mi, 2016-02-17 at 20:48 +, Robert Kern wrote: > > On Wed, Feb 17, 2016 at 8:43 PM, G Young > > wrote: > > > > > Josef: I don't think we are making people think more. They're > > > all > > keyword arguments, so if you don't want to

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread josef.pktd
On Wed, Feb 17, 2016 at 3:58 PM, G Young wrote: > I sense that this issue is now becoming more of "randint has become too > complicated" I suppose we could always "add" more functions that present > simpler interfaces, though if you really do want simple, there's always > Python's random library

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Sebastian Berg
On Mi, 2016-02-17 at 20:48 +, Robert Kern wrote: > On Wed, Feb 17, 2016 at 8:43 PM, G Young wrote: > > > Josef: I don't think we are making people think more. They're all > keyword arguments, so if you don't want to think about them, then you > leave them as the defaults, and everyone is hap

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
I sense that this issue is now becoming more of "randint has become too complicated" I suppose we could always "add" more functions that present simpler interfaces, though if you really do want simple, there's always Python's random library you can use. On Wed, Feb 17, 2016 at 8:48 PM, Robert Ker

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Robert Kern
On Wed, Feb 17, 2016 at 8:43 PM, G Young wrote: > Josef: I don't think we are making people think more. They're all keyword arguments, so if you don't want to think about them, then you leave them as the defaults, and everyone is happy. I believe that Josef has the code's reader in mind, not th

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Joe: fair enough. A separate function seems more reasonable. Perhaps it was a wording thing, but you kept saying "wrapper," which is not the same as a separate function. Josef: I don't think we are making people think more. They're all keyword arguments, so if you don't want to think about them

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Robert Kern
On Wed, Feb 17, 2016 at 8:30 PM, Alan Isaac wrote: > > On 2/17/2016 12:28 PM, G Young wrote: >> >> Perhaps, but we are not coding in Haskell. We are coding in Python, and >> the standard is that the endpoint is excluded, which renders your point >> moot I'm afraid. > > I am not sure what "standar

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
On 2/17/2016 12:28 PM, G Young wrote: Perhaps, but we are not coding in Haskell. We are coding in Python, and the standard is that the endpoint is excluded, which renders your point moot I'm afraid. I am not sure what "standard" you are talking about. I thought we were talking about the user

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread josef.pktd
On Wed, Feb 17, 2016 at 2:20 PM, wrote: > > > On Wed, Feb 17, 2016 at 2:09 PM, G Young wrote: > >> Yes, you are correct in explaining my intentions. However, as I also >> mentioned in the PR discussion, I did not quite understand how your wrapper >> idea would make things any more comprehensive

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread josef.pktd
On Wed, Feb 17, 2016 at 2:09 PM, G Young wrote: > Yes, you are correct in explaining my intentions. However, as I also > mentioned in the PR discussion, I did not quite understand how your wrapper > idea would make things any more comprehensive at the cost of additional > overhead and complexity

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Joseph Fox-Rabinovitz
My point is that you are proposing to make the overall API have counter-intuitive behavior for the sake of adding a new feature. It is worth a little bit of overhead to have two functions that behave exactly as expected. Josef's footnote is a good example of how people will feel about having to fig

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Yes, you are correct in explaining my intentions. However, as I also mentioned in the PR discussion, I did not quite understand how your wrapper idea would make things any more comprehensive at the cost of additional overhead and complexity. What do you mean by making the functions "consistent" (

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Joseph Fox-Rabinovitz
On Wed, Feb 17, 2016 at 1:37 PM, wrote: > > > On Wed, Feb 17, 2016 at 10:01 AM, G Young wrote: >> >> Hello all, >> >> I have a PR open here that makes "low" an optional parameter in >> numpy.randint and introduces new behavior into the API as follows: >> >> 1) `low == None` and `high == None` >>

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread josef.pktd
On Wed, Feb 17, 2016 at 10:01 AM, G Young wrote: > Hello all, > > I have a PR open here that > makes "low" an optional parameter in numpy.randint and introduces new > behavior into the API as follows: > > 1) `low == None` and `high == None` > > Numbers a

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Perhaps, but we are not coding in Haskell. We are coding in Python, and the standard is that the endpoint is excluded, which renders your point moot I'm afraid. On Wed, Feb 17, 2016 at 5:10 PM, Alan Isaac wrote: > On 2/17/2016 11:46 AM, Robert Kern wrote: > >> some at least are 1-based indexing

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
On 2/17/2016 11:46 AM, Robert Kern wrote: some at least are 1-based indexing, so closed intervals do make sense. Haskell is 0-indexed. And quite carefully thought out, imo. Cheers, Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Actually, it has already been deprecated because I did it myself. :) On Wed, Feb 17, 2016 at 4:46 PM, Robert Kern wrote: > On Wed, Feb 17, 2016 at 4:40 PM, Alan Isaac wrote: > > > > Behavior of random integer generation: > > Python randint[a,b] > > MATLAB randi [a,b] > > Mma RandomInte

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Robert Kern
On Wed, Feb 17, 2016 at 4:40 PM, Alan Isaac wrote: > > Behavior of random integer generation: > Python randint[a,b] > MATLAB randi [a,b] > Mma RandomInteger [a,b] > haskell randomR [a,b] > GAUSS rndi[a,b] > Maple rand[a,b] > > In short, NumPy's `randint` is non-standard

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread Alan Isaac
Behavior of random integer generation: Python randint[a,b] MATLAB randi [a,b] Mma RandomInteger [a,b] haskell randomR [a,b] GAUSS rndi[a,b] Maple rand[a,b] In short, NumPy's `randint` is non-standard (and, I would add, non-intuitive). Presumably was due due to relying

Re: [Numpy-discussion] making "low" optional in numpy.randint

2016-02-17 Thread G Young
Hello all, I have a PR open here that makes "low" an optional parameter in numpy.randint and introduces new behavior into the API as follows: 1) `low == None` and `high == None` Numbers are generated over the range `[lowbnd, highbnd)`, where `lowbnd = n