Re: Class method handles in C

Andy Bensky (ab@infoseek.com)
Fri, 4 Mar 1994 13:12:19 +0800

I have run some tests which show it to be fairly easy to register an use
unbound methods from C as long as the firs param in the arglist is an
instance of the class. Thanks, Guido, for making the call_object() and
call_function() code so easily readable so that I could figure that out!

I still can't figure out, however, how to create a new instance of a class.
Passing in the unbound __init__ method doesn't work sine there is no class
instance to pass in as the first argument so call_function() refuses to
invoke the function it was asked to.

I've located newinstanceobject() in Objects/classobject.c which I believe
will do what I want, but is this a recommended interface? In general,
would it be possible to document these C interfaces somewhere besides in the
code so that if they change in the future there will be a single point of
reference for what you may and may not count on being available from within
a C program?

Again - Kudos to Guido and his associates for making it so easy to locate
desired functions in the source code and making them really understandable!

Andy