[Python-ideas] [Python-Dev] Inclusive Range

Masklinn masklinn at masklinn.net
Tue Oct 5 14:10:46 CEST 2010

On 2010-10-05, at 13:51 , Carl M. Johnson wrote:

> On Tue, Oct 5, 2010 at 1:05 AM, Masklinn <masklinn at masklinn.net> wrote:
>>> (if we were creating a new language that was 1 indexed and range
>>> was likewise adjusted), the list [1] would be range(1), and the empty
>>> list would be range(0), so the whole issue could be neatly
>>> sidestepped. :-)
>> I fail to see what gets sidestepped there. Ignored at best.
> He was trying to be language neutral by writing using < and <= but
> that's part of his problem. He's too much of a mathematician.
> Rewriting things so that they don't use < or <= at all is the best way
> to explain things to a non-math person. If you say "range(1, 5) gives
> a range from 1 to 5" your explanation doesn't have to use < or <= at
> all.
But again, you don't sidestep anything. "a range from 1 to 5" is ambiguous and can be understood as any of the 4 relations Dijkstra provides. So it's only a good way to explain it in that 0. it doesn't expose a reader to semi-mathematical notation anybody over 12 should be able to understand and 1. it avoids any semblance of unambiguity and instead decides to leave all interpretation to the reader.

> This is unlike a C-like language where you would write int i=2;
> i<12; i++.
Uh what?

> So the question of what mathematics "really" underlies it
> can be sidestepped by using a language that many people know better
> than the language of mathematics: the English language.
No. As I said, it doesn't sidestep the issue but ignores it by replacing perfectly unambiguous notation by utterly ambiguous description.

More information about the Python-ideas mailing list