Is current integer for-loop syntax a wart?

Mike Dean klaatu at evertek.net
Fri Mar 8 16:56:13 EST 2002


Probably somewhere between Wart? and Not a wart.  Python's for loop is
very different from that present in C, or any of its derivitave
languages.  If we don't try to make it the same, it doesn't cause
problems (for me, at least).

Most of my Python programming has been short, many times one-time
scripts for things like data laundering, but never have I had to use
range().  I don't see how it's a problem, and seeing the arguments
caused by any solution hitherto proposed, I don't think it's worth
making a change to the language in this regard.  And every time 'special
cases' has come up (which seems to be quite common in this particular
debate), it's made me think of my recent, brief, and unpleseant journey
into the land of Perl.  Let's not take Python that direction...

-Mike


* Cromwell, Jeremy <jcromwell at ciena.com> [2002-08-03 10:26]:
> PEP 276 (Simple Iterator for ints) and PEP 284 (Integer for-loops), among
> others, are written from the perspective that the current integer for-loop
> syntax
> 
>     for i in range(10):
> 
> is a wart.  Is this true?  That is, where does the Python community stand on
> this issue?
> 
> If you will, please start your response by placing your description of the
> syntax in one of these categories.
> 
> -Major wart
> This is painful to type and I would support almost any type of improvement.
> 
> -Wart
> I don't like the current syntax and would like to see an improvement, but I
> could care less.
> 
> -Wart?
> What's wrong with it?  I guess it could be improved but I never thought
> about it.
> 
> -Not a wart
> This is the most pythonic way to write an integer for loop.  I would oppose
> almost any change.
> 
> Not to bias the results, but I'd be just as interested to hear from the
> "Wart?" group as any other.
> 
> References
> PEP 276, Simple Iterator for ints
> http://www.python.org/peps/pep-0276.html
> PEP 284, Integer for-loops
> http://www.python.org/peps/pep-0284.html
> 
> -Jeremy Cromwell
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list