[Python-Dev] if-syntax for regular for-loops

Leif Walsh leif.walsh at gmail.com
Sat Oct 4 00:24:52 CEST 2008


On Fri, Oct 3, 2008 at 12:33 PM, Andreas Nilsson <adde at trialcode.com> wrote:
> Thanks for the pointer!
> I don't buy the argument that newlines automagically improves readability
> though. You also get increased nesting suggesting something interesting is
> happening where it isn't and that hurts readability.
> And as Vitor said, all other constructions of the form 'for i in items' can
> have if-conditions attached to them, it's really not that far-fetched to
> assume that the loop behaves the same way. Consistency good, surprises bad.

Yeah, I know what you mean, and I kind of liked the idea of adding the
if statement to the for loop (for consistency, if nothing else), but
it's been discussed before, and plenty of people have made the same
argument.  Probably not worth it.

-- 
Cheers,
Leif


More information about the Python-Dev mailing list