Is current integer for-loop syntax a wart?

brueckd at tbye.com brueckd at tbye.com
Fri Mar 8 14:39:42 EST 2002


On Fri, 8 Mar 2002, Cromwell, Jeremy wrote:

> 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?

-Wart? Who cares, really, anyway? :) It's not a major source of bugs,
productivity drainage, etc. Seeing range() in the code doesn't force you
to pause and figure out what it means (at least no more so than any of the
proposed alternatives); you learn it the first time and don't really think
about it again. Put another way, if somebody discovers the One Perfect
Range Replacement Idiom and adds it to Python, will it make a difference
in anything important? I don't think so.

Especially in light of Skip's recent plea for more community help, it
seems silly to spend too much time on issues like this when there are
bigger fish to fry. Even if I concede that this *is* a wart, it's really
hard to argue that fixing it is more beneficial than fixing actual bugs,
improving Python's performance, improving the documentation, maturing the
modules in the standard library, developing supporting projects (e.g. CPAN
replacement), teaching others to use Python, etc.

-Dave





More information about the Python-list mailing list