title: Python C Extensions - Why must callable C functions take arguments and return PyObject *
body: <p>I'm just starting to play with Python C extensions and am curious as to why a C function, which is callable from Python must take 2 PyObject* arguments and return a PyObject*. I wrote the following "Hello World" extension:</p>
  
  <pre><code>#include &lt;Python.h&gt;
  
  static PyObject *
  hello_world(PyObject *self, PyObject *noargs)
  {
     printf("Hello World\n");
     return Py_BuildValue("");
  }
  
  
  // Module functions table.
  
  static PyMethodDef
  module_functions[] = {
      { "hello_world", hello_world, METH_NOARGS, "hello world method" },
      { NULL }
  };
  
  
  // This function is called to initialize the module.
  PyMODINIT_FUNC
  inittesty2(void)
  {
      Py_InitModule("testy2", module_functions);
  }
  </code></pre>
  
  <p>Why can't I (especially with METH_NOARGS) use the following hello_world method:</p>
  
  <pre><code>static void
  hello_world()
  {
     printf("Hello World\n");
  }
  </code></pre>
  
  <p>?</p>