Python Binding

STiAT ggrabler at gmail.com
Tue May 8 06:07:28 EDT 2007


Hello,

I've basically had plans on just extending python for the wrapper.
That basically works fine, i just don't get along by the types
provided (http://docs.python.org/ext/ext.html).

Anyway, i want to extend python for types. The problem i currently
experience is the following.

Guess what - i have a base class, doing some wrapping. Currently,
called pybtest (just testing around though).
Now, i'd need a configuration object, accessable in python. By using
the library, it should be possible to access it using
pybtest.config.insertValue('xyz') as an example, but i havn't found
any way to archive this yet.

If i write config as an own (external) type, i can't get it into the
pybtest object for some reason. It's compiled as an extra "config.so",
and with the test script i need to do import config. Anyway, it's not
in the pybtest object., i've to build up a config and pass it by to
the pybtest binding, so it can set it's internal configuration
structures.

If i try to compile it within the pybtest, i can't use ext_modules,
and as expected, i can't do another pybtestinit function, so it's
quite useless, at least with the knowledge i could get out of the
documentation.

By just making a include file of the type, including the type
definition adding up some functions to pybtest, i actually can access
it, without the wanted functionality of pybtest.config.

Why do you all suggest other things than the way suggested by python?
I havn't got a real problem writing the code in C, actually, it looked
as if it would give me several possibilities i wouldn't have with
pyrex (like binding more library functions to one provided python
function and so on). I havn't had a closer look to SWIG yet.

It looks as if i could just provide single objects or modules, and no
additional object into a module.

Does anyone have closer knowledge on this?
Btw: Sorry for the long delay time, i had to describe the things
closer, and had to take a deeper look into the bindings than i had
before.

Kind regards,
Georg




More information about the Python-list mailing list