Necessity of ``pass''

forcer forcer at mindless.com
Tue Aug 24 05:44:19 EDT 1999


wtanksle at dolphin.openprojects.net (William Tanksley) writes:

> forcer at mindless.com (forcer) writes:
> >   def f(arg): pass    # a function that does nothing (yet)
> 
> >one could write
> 
> >	if foo:
> >	bar
> 
> >Syntactically this does not introduce any ambiguity. The only
> >problem i see is that the "pass" version is more readable.
> 
> Precisely.  You're suggesting a change with the sole purpose of reducing
> redundancy.  The problem is that humans _need_ redundancy.  Not only does
> redundancy help us to read the code, it also helps the computer to find
> our errors.

The important point here is that the necessity of ``pass'' gets
into your way in some places. I agree that some redunancy is nice
if it helps to read the code, but it shouldn't get into your way.

You didn't quote the example where i pointed out the real
problem with pass:

if foo:
   # bar
   # baz
qux

E.g. if you're developing code and just commented out a (not yet
worked out branch) to work on a different part of the program.
Requireing pass here is unecessary.

I didn't ask for pass to vanish completely, i merely asked for it
to optional instead of mandatory.

> Another example of redundancy in Python -- and one with just as much
> chance of being changed -- is the ':' symbol.  Take a look at the following:

Though the colon really improves readability while not getting in
your way :)

	-forcer

-- 
((email . "forcer at mindless.com")       (www . "http://forcix.cx/")
 (irc   . "forcer@#StarWars (IRCnet)") (gpg . "/other/forcer.gpg"))




More information about the Python-list mailing list