[Python-Dev] What's a PyStructSequence ?

Martin v. Loewis martin@v.loewis.de
Tue, 27 Nov 2001 22:21:33 +0100


> What are they used at the C level for?

To return them to Python. You write

  Py_INCREF(Py_True);
  return Py_True;

or

  result = c ? Py_True : Py_False;
  Py_INCREF(result);
  return result;

just as you return None. That saves atleast one function call.

Py_True, of course, *is* 1. There is no proper boolean type.

Regards,
Martin