[beginner] What's wrong?

Michael Selik michael.selik at gmail.com
Fri Apr 1 19:29:15 EDT 2016


Humans have always had trouble with this, in many contexts. I remember
being annoyed at folks saying the year 2000 was the first year of the new
millennium, rather than 2001. They'd forgotten the Gregorian calendar
starts from AD 1.

On Fri, Apr 1, 2016, 6:58 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?
>
> --
> 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