from future import pass_function

Chris Angelico rosuav at
Wed Jul 25 18:05:39 CEST 2012

On Wed, Jul 25, 2012 at 6:40 PM, Ulrich Eckhardt
<ulrich.eckhardt at> wrote:
> I just had an idea, it occurred to me that the pass statement is pretty
> similar to the print statement, and similarly to the print() function, there
> could be a pass() function that does and returns nothing.
> Example:
>    def pass():
>        return
>    try:
>        do_something()
>    except:
>        pass()

Except that "pass" is a syntactic construct that basically says "hey,
I have an indented block here, but there's no code in it". It's not
executable any more than the syntactic token "INDENT" is. It's more
closely related to the colon at the end of "try" than it is to the
"do_something()" call.

By comparison, Python 2's print statement is executable. It causes
real action to happen at run-time. It makes sense to pass "print" as
an argument to something; for instance:

def some_generator():
   yield blah


Simple way of making the iterator display its yielded result. I cannot
imagine any circumstance in which you'd want to map "pass" over
everything. But then, as Teresa said, I'm only one, and possibly I'm


More information about the Python-list mailing list