Python "why" questions

Roy Smith roy at panix.com
Sun Aug 15 20:59:36 EDT 2010


In article <8crg0eFfbkU1 at mid.individual.net>,
 Gregory Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Not always -- mathematicians use whatever starting index is
> most convenient for the problem at hand.

Which may be 0, 1, or something else.  There are plenty of situations, 
for example, where you might want to use both positive and negative 
indices.  Which work with Python lists, but not the way a mathematician 
would expect :-)

In general, I've found, "Because that's the way they do it in math", to 
be an unreliable guide to, "How should we do it in a programming 
language?"  It's often a reasonable place to start, but there are other 
considerations.



More information about the Python-list mailing list