[Tutor] static PyObject * or non-static
Rob Benton
rob.benton at conwaycorp.net
Thu Sep 2 17:04:15 CEST 2004
Hey I've been reading through the Extending and Embedding section of the
python docs. One thing that keeps appearing is a chunk of code like this:
Section 2.1.1 Adding Data and Methods to the Basic Example
=================================================================
static PyObject *
Noddy_name(Noddy* self)
{
static PyObject *format = NULL;
PyObject *args, *result;
if (format == NULL) {
format = PyString_FromString("%s %s");
if (format == NULL)
return NULL;
}
...
}
=================================================================
I'm curious as to why the format PyObject * is made static. Should I
make everything static that can be? I didn't know if maybe there was a
reason for doing that.
More information about the Tutor
mailing list