More PyArg questions?

Paul F. Dubois pauldubois at home.com
Fri Jul 7 11:58:05 EDT 2000


Arinté <shouldbe at message.com> wrote in message
news:fLl95.37562$NP5.1182716 at newsread2.prod.itd.earthlink.net...
> Is PyArg_ParseTuple and PyArg_ParseTupleKeywords (or whatever it is) the
> only two to monkey are with arguments passed from python to c++?
There is no law against using the CAPI to get arguments individually from
the tuple of args and disposing of them one at a time as desired.
>
> Also, what would be the best way to set a string that the python script
> wants to be filled in.  Ex.
> some.py
> fillinstring = " "
> cplusplusapp.read(fillinstring)
>
> What is the best way for C++ apps to fill in that string?  Are python
> strings going to be resizable?
>
Python strings are not only not resizeable they are IMMUTABLE. Your example
coding would likely cause great harm.
The easiest way to do this is make the string a part of the return:
fillinstring = cplusplusapp.read()

You can create the string in the C API using e.g. PyString_FromString.






More information about the Python-list mailing list