In the docs for randrange()
, it states:
Keyword arguments should not be used because they can be interpreted in unexpected ways. For example
randrange(start=100)
is interpreted asrandrange(0, 100, 1)
.
If the signature is random.randrange(start, stop[, step])
, why doesn’t randrange(start=100)
raise an error, since stop
is not passed a value?
Why would randrange(start=100)
be interpreted as randrange(0, 100, 1)
?
I’m not trying to understand the design choice of whoever wrote the code, so much as understanding how it’s even possible. I thought parameters without default values need to be passed arguments or else a TypeError would be raised.