Writing a CPython extension - calling another sibbling method ?
R.Wieser
address at not.available
Mon Nov 18 15:15:27 EST 2019
MRAB,
> One possibility is to refactor the code so that py_proc1 and py_proc2
> themselves just handle their arguments and then call the function that
> does the actual work.
The thing is that the arguments of py_proc1 and py_proc2 are the same, but
for a single argument. Which means that letting both of them first parse
their own arguments means duplicated code. Which I do not really want and
thus try to evade
But yes, that is a possibility too. The "the function that does the actual
work" part is what I tried to describe with my second example.
> A clunkier way would be to make a new tuple that consists of the prepended
> item and the items of args and pass that to py_proc1 as its args.
That is what I tried to describe with my first example.
The thing is I have no clue about what the above calling should look like
(though I think I already found how to append my argument to the "args"
string-object).
In other words, do you have any idea of what either of those calling methods
should look like ? An example perhaps ? Having only encountered the
CPython API two days ago I'm still fumbling in the dark I'm afraid.
Regards,
Rudy Wieser
More information about the Python-list
mailing list