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

Michael Foord fuzzyman at voidspace.org.uk
Tue Oct 5 15:07:41 CEST 2010


On 5 October 2010 12:51, Carl M. Johnson <cmjohnson.mailinglist at gmail.com>wrote:

> [snip...]
>
> Yup. TANSTAAFL. That's why we shouldn't actually bother to change
> things: you lose on the backend what you gain on the frontend. I'm
> just curious about whether starting programmers have a strong
> preference for one or the other convention or whether both are
> confusing.
>

Both teaching new programmers and programmers coming from other languages
I've found them confused by the range behaviour and usually end up having to
apologise for it (a sure sign of a language wart).

It is *good* that range(5) produces 5 values (0 to 4) but *weird* that
range(3, 10) doesn't include the 10.

Changing it now would be *very* backwards incompatible of course. Python 4
perhaps?

All the best,

Michael Foord



> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
http://www.voidspace.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101005/dfa0bb19/attachment.html>


More information about the Python-ideas mailing list