On 2024-01-03 23:17:34 -0500, Thomas Passin via Python-list wrote:
> On 1/3/2024 8:00 PM, Alan Gauld via Python-list wrote:
> > On 03/01/2024 22:47, Guenther Sohler via Python-list wrote:
> > > Hi,
> > >
> > > In my cpython i have written quite some functions to modify "objects".
> > > and their p
Hi list
The approach with defining the methods from python appears to be a very
good idea and it also works for classes, defined in python side.
However, when I try this one:
def mytrans(self):
print(self)
c=cube()
cls=c.__class__
cls.trans=mytrans
I get this:
Traceback (most recent call
On 04/01/2024 04:17, Thomas Passin via Python-list wrote:
>> I'm probably missing something obvious here but can't you
>> just assign your function to a class member?
>>
>> def myFunction(obj, ...): ...
>>
>> class MyClass:
>> myMethod = myFunction
>
> That works if you assign the function t
On 1/3/2024 8:00 PM, Alan Gauld via Python-list wrote:
On 03/01/2024 22:47, Guenther Sohler via Python-list wrote:
Hi,
In my cpython i have written quite some functions to modify "objects".
and their python syntax is e.g.\
translate(obj, vec). e.g whereas obj is ALWAYS first argument.
Howev
Thank you for your answers.
apparently I did not express myself clear enough. Let me rephrase.
I got an embedded C function like this:
==
PyObject *python_translate(PyObject *self, PyObject *args, PyObject *kwargs)
{
char *kwlist[] = {"obj", "v", NULL};
PyObject *v = NULL;
PyObject *obj =
On 1/3/2024 11:17 PM, Thomas Passin wrote:
On 1/3/2024 8:00 PM, Alan Gauld via Python-list wrote:
On 03/01/2024 22:47, Guenther Sohler via Python-list wrote:
Hi,
In my cpython i have written quite some functions to modify "objects".
and their python syntax is e.g.\
translate(obj, vec). e.g wh
On 03/01/2024 22:47, Guenther Sohler via Python-list wrote:
> Hi,
>
> In my cpython i have written quite some functions to modify "objects".
> and their python syntax is e.g.\
>
> translate(obj, vec). e.g whereas obj is ALWAYS first argument.
> However, I also want to use these functions as clas
Hi,
In my cpython i have written quite some functions to modify "objects".
and their python syntax is e.g.\
translate(obj, vec). e.g whereas obj is ALWAYS first argument.
on c side this functions looks like:
PyObject *python_translate(PyObject *self, PyObject *args, PyObject *kwargs)
this works