pre-PEP for optional 'pass'

Fernando Pérez fperez528 at yahoo.com
Tue Apr 16 13:43:09 EDT 2002


Russell E. Owen wrote:

> In article <slrnabmoci.dhk.philh at comuno.freeserve.co.uk>,
>  philh at comuno.freeserve.co.uk (phil hunt) wrote:
> 
>>OK, I've decided to write a PEP. Preliminary to this, I'd like
>>people's comments.
>>
>>I wish to make the pas startement optional. That is, in any Python
>>program where there is a pass it can be left out and the meaning of
>>the program is unchanged...
> 
> I'd go along with it and offer a third rationale:
> 
> The need for pass is a pain when commenting out entire blocks of code
> (e.g. while debugging). Instead of just commenting out the code, one
> must also add a "pass" statement, and then try to remember to take it
> out again when re-enabling the code.

??? You can simply wrap the block you want to comment out in """...""" and be 
done with it. It becomes a dummy string, no need for pass and it's out of the 
way.

> In my opinion an optional pass is a very good thing -- sometimes you
> want to be able to assert "this block intentionally left blank", but
> sometimes it makes more sense to just accept a truly empty block.

And then you have the following:
if this_is_true:
do_that()

Was that an indentation mistake? Or is the if... still unimplemented with an 
implied pass? At that point python is back to the joys of C's

if (this_is_true)
        do_that();
        and_that();  // For non-C-ers, this is NOT part of the if block :)

Remember? :) No thanks.


> Thanks for proposing this. I'm sure you'll get lots of horrified
> reactions (remember the fuss whenever someone suggests removing the
> required colon at the start of blocks? Forgetting that damn colon is
> still the most common mistake I make when coding Python, so I'd love to
> see it go, but it'll be a cold day in hell...)

Besides, you already saw Guido's unambiguous response, so this discussion is 
strictly of academic interest.

Best,

f.



More information about the Python-list mailing list