semicolon at end of python's statements

Jussi Piitulainen jpiitula at ling.helsinki.fi
Sat Aug 31 06:28:09 EDT 2013


Paul Rudin writes:
> Jussi Piitulainen writes:
> 
> > # Option 1.5
> > for spam in sequence:
> >     if not predicate(spam): continue
> >     process(spam)
> >
> > This saves an indent level.
> 
> Just out of interest: is saving an indent level a useful thing?

It might be if process(spam) is a more complex statement.

> I wouldn't lay out my code like that just because if you're coming
> back to it later and reading through quickly it's (to my mind at
> least) easier to miss what's going on.

I agree with the general principle but I have actually done the above
(once or twice) precisely because I found it to be the clearer choice
in a particular situation.



More information about the Python-list mailing list