getting rid of pass

D

David Murmann

Hi all!

i just had this crazy idea:

instead of

while cond():
pass

write

while cond().

or

try:
import xyz
except ImportError:
pass

compared to

try:
import xyz
except ImportError.

i don't know whether this is syntactically unambiguous or replaces all
uses of pass, but i find it quite nice to read.

also if something like this has been proposed before and rejected, i
apologize for this late-in-the-night idea.

what do you people think?


have a nice day, David.
 
T

Terry Reedy

David Murmann said:
i just had this crazy idea:

Agreed ;-)
instead of
while cond():
pass
write
while cond().

Viewing statememts as functions of the program state, pass is the identity
function/statement. Many languages have the equivalent. Being explicit is
Python's style. Getting rid of it would gratuitously break code for no
reason other than your esthetic preference.
i don't know whether this is syntactically unambiguous or replaces all
uses of pass, but i find it quite nice to read.

while x/3.

would become somewhat ambiguous.

Terry Jan Reedy
 
B

Bruno Desthuilliers

David Murmann a écrit :
Hi all!
>
i just had this crazy idea:
>
instead of

while cond():
pass

write

while cond().
Yuck

or

try:
import xyz
except ImportError:
pass

compared to

try:
import xyz
except ImportError.

Yuck again
i don't know whether this is syntactically unambiguous or replaces all
uses of pass, but i find it quite nice to read.

I don't. I find it highly unreadable. I really find the pass statement
to be a great idea, and to highly improve readability.
also if something like this has been proposed before and rejected, i
apologize for this late-in-the-night idea.

what do you people think?

Please don't feel offended, but I think it would be a very bad thing to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top