osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Embedding Python in C


Am 17.07.19 um 20:39 schrieb Jesse Ibarra:
> My options seem rather limited, I need to make a Pipeline from (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does not support Python directly I have to settle with the C/Python API (https://docs.python.org/3.6/extending/embedding.html#beyond-very-high-level-embedding-an-overview). Any suggestions?
> 

Ah, now you finally tell us your problem!

Depending on, how complete / advanced / efficient the bridge needs to 
be, it can be easy or hard.

What level of integration do you want to achieve? Do you want

a) to call Python functions from Smalltalk
b) call Smalltalk functions from Python
c) pass callbacks around, e.g. use a Smalltalk function within a Python 
list comprehension, and if so, which way
d) integrate the class systems - derive a Python class from a Smalltalk 
base or the other way round

e) ?


The most basic thing is a), but even getting that right might be 
non-trivial, since both C APIs will have different type systems which 
you need to match. I don't speak Smalltalk, so can't comment in detail 
on this - but in practice it will also depend on the implementation you 
are using.

Best regards,

	Christian