[Zope] Python coding question

Clarence Gardner clarence@netlojix.com
Wed, 1 Dec 1999 10:10:38 -0800 (PST)


> 
> What I want to know is that if you have a C function like this:
>     int Hello (char *somestring, int *someint)
> it now seems that python can get only the value sentback by
> return???
> How can I send back to python changes in someint and somestring?

You can't, just as if you have a python function you have to return
the changed objects:
   def Hello(somestring, someint):
       ...
	   return (somestring_changed, someint_changed)
you have to do the same from C, e.g.,
	return Py_BuildValue("s#", newstring, newint)

All of your Python callable functions need to return a PyObject *
referring to a Python object (or 0 to indicate an exception has been
raised).

-=-=-=-=-=-=-=-=
Clarence Gardner
Software Engineer
NetLojix Communications, Inc.    NASDAQ:NETX
clarence@netlojix.com