On Mi, 2016-02-17 at 22:10 +0100, Sebastian Berg wrote:
> On Mi, 2016-02-17 at 20:48 +0000, Robert Kern wrote:
> > On Wed, Feb 17, 2016 at 8:43 PM, G Young <gfyoun...@gmail.com>
> > 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 the code's
> > writer. As a reader of other people's code (and I count 6-months
> > -ago
> > -me as one such "other people"), I am sure to eventually encounter
> > all of the different variants, so I will need to know all of them.
> > 
> 
> Completely agree. Greg, if you need more then a few minutes to
> explain
> it in this case, there seems little point. It seems to me even the
> worst cases of your examples would be covered by writing code like:
> 
> np.random.randint(np.iinfo(np.uint8).min, 10, dtype=np.uint8)
> 
> And *everyone* will immediately know what is meant with just minor
> extra effort for writing it. We should keep the analogy to "range" as
> much as possible. Anything going far beyond that, can be confusing.
> On
> first sight I am not convinced that there is a serious convenience
> gain
> by doing magic here, but this is a simple case:
> 
> "Explicit is better then implicit"
> 
> since writing the explicit code is easy. It might also create weird
> bugs if the completely unexpected (most users would probably not even
> realize it existed) happens and you get huge numbers because you
> happened to have a `low=0` in there. Especially your point 2) seems
> confusing. As for 3) if I see `np.random.randint(high=3)` I think I
> would assume [0, 3)....
> 

OK, that was silly, that is what happens of course. So it is explicit
in the sense that you have pass in at least one `None` explicitly.

But I am still not sure that the added convenience is big and easy to
understand [1], if it was always lowest for low and highest for high, I
remember get it, but it seems more complex (though None does also look
a a bit like "default" and "default" is 0 for low).

- Sebastian

[1] As in the trade-off between added complexity vs. added convenience.


> Additionally, I am not sure the maximum int range is such a common
> need
> anyway?
> 
> - Sebastian
> 
> 
> > --
> > Robert Kern
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to