Style question...

Chad Netzer cnetzer at
Thu Aug 28 01:20:39 CEST 2003

On Wed, 2003-08-27 at 15:45, Anthony Roberts wrote:
> If I end indentation levels with "pass" statements, will I piss off people
> that have to read my code? eg:
> for i in xrange(0,5):
>     if i:
>         print i
>         pass
>     print i * -1
>     pass

I do this myself at times, to help emacs.  But I'd suggest you not
overdo it.  It is more "pythonic" to simply leave the line blank (ie.
vertical whitespace), than have "pass" everywhere.

Pressing backspace once (to undo the auto-indent that emacs gives inside
loops) is less typing than 'pass'.  And if you need to reindent large
chunks of code, you are better off using emacs block indent/dedent
feature than relying on "pass" as defacto block delimiter (this has been
my experience)

Also, look into the script (included in Python's "Tools"
directory with the distribution), for another way of producing block
closing tokens.


Chad Netzer

More information about the Python-list mailing list