Necessity of ``pass''

John Mitchell johnm at magnet.com
Tue Aug 24 14:55:48 EDT 1999


On 24 Aug 1999, Justin Sheehy wrote:

> forcer <forcer at mindless.com> writes:
> 
> > You didn't quote the example where i pointed out the real
> > problem with pass:
> > 
> > if foo:
> >    # bar
> >    # baz
> > qux


Try this:

if 0 and foo:
	bar
	baz
qux


If you enable/disable this code often, try this one:

if 01 and foo:
	bar
	baz
qux


A one-character change, deleting/removing the '1', will disable/re-enable
the code. (I first heard this technique from Roy Edwards for C code.)


And for the record, I use "pass" quite a bit.  It's just a marker saying
loud and clear "do nothing", as opposed to the very-shakey ";" do-nothing
in C.


- j






More information about the Python-list mailing list