Style question...

Dave Brueck dave at pythonapocrypha.com
Thu Aug 28 03:07:02 EDT 2003


On Thursday 28 August 2003 12:23 am, U. N. Owen wrote:
> Re: Anthony Roberts wrote:
> Re: >
> Re: > If I end indentation levels with "pass" statements, will I piss off
> people Re: > that have to read my code? eg:
> Re: >
> Re: > for i in xrange(0,5):
> Re: >     if i:
> Re: >         print i
> Re: >         pass
> Re: >     print i * -1
> Re: >     pass
> Re: >
> Re: > I ask for two reasons... a) it helps emacs figure it out, and b) I'm
> more Re: > comfortable ending compound statements with a token.
> Re:
> Re: Sorry, but yes, I find that ugly.  If you're just starting out with
> Re: Python, please just give it a shot without that approach for a while
> Re: and see whether you become much more comfortable *without* the token
> Re: than you ever were with it.
> Re:
> Re: -Peter
> Re: --
>
>
> Sorry, but no ;-) Ok it's "one line more", and
> is not very useful. But...
> For the moment I work on (a small part of) a project
> that has hundreds of thousands of lines, almost
> eveything in Python (and some in C and Fortran),
> and when you have a loop several pages long, or
> nested blocks to 8 levels or more, I may say
> it's *very* convenient to see where the end
> of a block exactly is. It's convenient to
> have some long variable names too.

Sorry, but yes * 2. ;-) Please just don't tolerate loops several pages long 
and/or nested blocks that deep - such things should occur very, very rarely 
(essentially never). Putting an end-block delimiter after such beasts is like 
putting a band-aid on top of a compound fracture.

-Dave





More information about the Python-list mailing list