from future import pass_function

Philipp Hagemeister phihag at
Wed Jul 25 12:30:01 CEST 2012

Unlike the print statement, pass has no overboarding complexity (like
>>, printing tuples, etc.) - it just serves as a marker (and
practicality beats purity).

And you don't ever want to use pass as a value (say, for map() or the
right side of an assignment). In fact, if pass were a function, users
could construct strange code like

x = pass()

def pass():
   raise Exception('Are you slacking off? Get back to work!')

And don't forget that while the parentheses mainly confuse users,
they're also making it harder to type, and feel like useless overhead
(similar to the parentheses in  if (x):  ). In fact, I'd argue that if
pass were a function, None would be the better placeholder:

    None # 2 hard-to-type (on a German keyboard) characters shorter
    # (and probably way faster: No function call overhead and no need
    #  to actually find out what pass happens to be in this context)

- Philipp

On 07/25/2012 10:40 AM, Ulrich Eckhardt wrote:
> Hi!
> 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()
> One thing I don't like about this is the syntax
>    class foo(object):
>        pass()
> What do you think?
> Uli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Python-list mailing list