Defining *class* methods on C code

Thomas Heller theller at python.net
Fri Feb 6 16:13:28 EST 2004


>> 	if (somecondition) {
>> 		PyObject *func;
>> 		PyObject *meth;
>> 		PyMethodDef *ml = my_methods;
>> 
>> 		for (; ml->ml_name; ++ml) {
>> 			func = PyCFunction_New(ml, NULL);
>> 			if (!func)
>> 				return NULL;
>> 			meth = PyClassMethod_New(func);
>
> How about "meth = PyDescr_NewClassMethod(result, ml);" here?
>

Yes, that works.  But it's not in Python 2.2, which is required ;-(

Thanks,

Thomas



More information about the Python-list mailing list