[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"None" and "pass"

ram at zedat.fu-berlin.de (Stefan Ram) writes:

>   A participant of my Python course asked whether one could
>   also use "None" instead of "pass". What do you think?
> def f():
>     pass
>   can also be written as
> def f():
>     None
>   . Is there any place where "None" could not be used 
>   instead of "pass"?

No, an expression is always a valid statement:


Use None, or 42+0, or 1+1+1+1+1+1+1+1+1, or whatever you want (that does
not have any side-effect and/or throw an exception). And be fired right
after your first code review.

-- Alain.