[Numpy-discussion] random.uniform documentation bug?

Robert Kern robert.kern at gmail.com
Tue Feb 23 15:12:35 EST 2010


On Tue, Feb 23, 2010 at 14:04, Friedrich Romstedt
<friedrichromstedt at gmail.com> wrote:
> Why not rewriting the definition of uniform() to:
>
> def uniform(start, stop, low = None, high = None):
>    if low is not None:
>        start = low
>    if high is not None:
>        stop = high
>    [and here what matters]
>
> This makes no trouble when a user uses either non-keyword or keyword
> specification.  The second pair of keywords is just for backward
> compatibility.  As after a keyword there is no positional argument
> allowed, the only call mixing keywords and non-keywords would be
> uniform(low, high = high), and this is also maintained.

Except for someone calling uniform(low, high, size). In any case, why
would you make this change? It doesn't seem to solve any problem or
clear up any semantics. "start" and "stop" imply a stop > start
relationship, too, albeit not as strongly. If someone wants to pass in
a high < low, let them.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list