handle for lsit constructor?

Andy Bensky (ab@infoseek.com)
Thu, 3 Mar 1994 17:19:43 +0800

I have a C function that needs to create and subsequently append to a
simple list. I can pass the callbacks for the append method into C
by passing in [].append and then calling that function directly from C
using call_object(). This method, however, will not pass the correct
'self' value into the append method and is therefore useles.

I have 2 questions:

1. Is there any sort of call_object() interface that allows the caller
to specify what 'self' object to work on (takes an arbitrary object * pointer).

2. Is there any way to pass in (from Python to C) a handle to the basic
list initializer, whatever is onvoked when you type [] in the interpreter.

If (1) is not available then it will be necessary to register a different
list append function for each and every list to be manipulated. Seems like
a waste of time and a major hassle.

If (2) is not available then it will be necessary to write a one-line function
that returns an empty list and pass a handle to that as the callback to use
from C. That's not difficult, but it seems like a needless indirection.

or would it be more correct to call the python c functions directly? Any
other ideas?

Thanks,

Andy Bensky
InfoSeek Corp.