from future import pass_function
steve+comp.lang.python at pearwood.info
Thu Jul 26 04:38:49 CEST 2012
On Wed, 25 Jul 2012 21:42:18 -0400, Ross Ridge wrote:
> Ulrich Eckhardt wrote:
>> I just had an idea, it occurred to me that the pass statement is pretty
>> similar to the print statement,
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>>What's the point of this?
> Remember everything you've said about why its a good thing the that
> print statement is now a function? That.
I can't believe I actually have to point this out explicitly, but pass is
not print. Apart from them both starting with the letter "P", they are
nothing alike. There are good reasons for making print a function, and
they don't apply to pass because pass doesn't do what print does.
The examples of pass-as-a-function shown by the Original Poster don't
give any clue of what advantage there is to make pass a function. It
appears that the only reason for this suggested change is that he would
rather write "pass()" instead of "pass", possibly because he thinks it
(Actually, I reckon that what is driving this idea is that the OP is a
beginner, and he's got a syntax error a few times from writing "pass()",
and so he thought it would be easier to force other people to change tens
or hundreds of thousands of Python programs to use "pass()" instead of
"pass" than to just learn to stop putting parentheses after it. I
remember what it was like to be a beginner with six weeks experience in a
twenty year old language, full of shiny new ideas for "improving" it.)
But of course I could be wrong. Ulrich, if you are still reading this, if
you have good examples for how pass as a function would actually be
better, and how it will let you do things in Python that can't easily be
done now, I'm very interested to hear them. Who knows, if the idea is
good enough, some day it may even happen.
More information about the Python-list