[beginner] What's wrong?

William Ray Wing wrw at mac.com
Sat Apr 2 00:54:21 EDT 2016


> On Apr 1, 2016, at 6:57 PM, Mark Lawrence via Python-list <python-list at python.org> wrote:
> 
>> On 01/04/2016 23:44, sohcahtoa82 at gmail.com wrote:
>>> On Friday, April 1, 2016 at 3:10:51 PM UTC-7, Michael Okuntsov wrote:
>>> Nevermind. for j in range(1,8) should be for j in range(8).
>> 
>> I can't tell you how many times I've gotten bit in the ass with that off-by-one mistake whenever I use a range that doesn't start at zero.
>> 
>> I know that if I want to loop 10 times and I either want to start at zero or just don't care about the actual number, I use `for i in range(10)`.  But if I want to loop from 10 to 20, my first instinct is to write `for i in range(10, 20)`, and then I'm left figuring out why my loop isn't executing the last step.
> 
> "First instinct"?  "I expected"?  The Python docs might not be perfect, but they were certainly adequate enough to get me going 15 years ago, and since then they've improved.  So where is the problem, other than failure to RTFM?
> 
I've always found it vaguely amusing that the server(s) for just about all the technical info at MIT reside behind http://rtfm.mit.edu

Bill

> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list