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

Juan Nunez-Iglesias jni.soma at gmail.com
Wed Feb 17 18:48:39 EST 2016


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 <alan.isaac at gmail.com> wrote:

> 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 think if we start citing persistant conventions, the
> persistent convention across *many* languages that the bounds
> provided for a random integer range are inclusive also counts for
> something, especially when the names are essentially shared.
>
> But again, I am just trying to be clear about what is at issue,
> not push for a change.  I think citing non-existent standards
> is not helpful.  I think the discrepancy between the Python
> standard library and numpy for a function going by a common
> name is harmful.  (But then, I teach.)
>
> fwiw,
>
> Alan
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160218/1ab9358e/attachment.html>


More information about the NumPy-Discussion mailing list