Python handles globals badly.

Random832 random832 at
Wed Sep 9 02:02:24 CEST 2015

MRAB <python at> writes:
> If you're allowed to specify both bounds, why would you be forbidden
> from negative ones?

It makes it non-obvious what value should be returned from e.g. search
methods that return a negative number on failure. .NET's IndexOf
function returns -1, but MaxValue if the array has a negative
bound. BinarySearch returns the complement of the nearest index to the
value you were searching for, which requires some gymnastics if you want
to make use of it for an array that has negative and positive bounds.

More information about the Python-list mailing list