<div class="gmail_quote">On Tue, Apr 29, 2008 at 10:30 AM, Alexander Belopolsky <<a href="mailto:alexander.belopolsky@gmail.com">alexander.belopolsky@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">or sizable. I would say "range(n) is a memory efficient substitute<br></div>
for [0, 1, ... n-1]" is easier to fit into one's brain that the<br>
current hodgepodge of exceptions.<br></blockquote><div><br></div><div>For what it's worth, I'm -1 on any change that makes range(10**10)</div><div>an error. I'd like to be able to write</div><div><br></div><div>
for i in range(n):</div><div> ...</div><div><br></div><div>without having to stop and worry about whether n is always going</div><div>to be small enough to avoid an exception, and what to do if there's</div><div>a possibility that n is large. The common case of range should</div>
<div>have a small mental footprint.</div><div><br></div><div>Indexing a range object, or taking its length, are surely much rarer</div><div>than simply iterating over it; I don't think the problems with indexing</div>
<div>and length are a good reason to impose restrictions on the use</div><div>of range as an iterable.</div><div><br></div><div>Mark</div><div><br></div></div>