Raymond Hettinger wrote:

>   class List(list):
>     def append(self, x):
>       print x
>       List.append(self, x)  # What is the C equivalent of this call?

Something like

   PyObject *meth, *result;
   meth = PyObject_GetAttrString(PyList_Type, "append")
   result = PyObject_CallFunctionObjArgs(meth, self, x, NULL)

plus appropriate error checking.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,          | Carpe post meridiem!                 |
Christchurch, New Zealand          | (I'm not a morning person.)          |
[EMAIL PROTECTED]          +--------------------------------------+
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to