How to define a function with an empty body?
Chris Rebert
clp2 at rebertia.com
Sat Sep 12 23:38:47 EDT 2009
On Sat, Sep 12, 2009 at 8:37 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> Hi,
>
> I want to define a function without anything in it body. In C++, I can
> do something like the following because I can use "{}" to denote an
> empty function body. Since python use indentation, I am not sure how
> to do it. Can somebody let me know how to do it in python?
>
> void f() {
> }
Use the no-op `pass` keyword:
def f():
pass
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list