How to get C and python functions into the same namespace?

Kevin Cazabon kcazabon at home.com
Sat Dec 11 13:51:01 EST 1999


How about wrapping it into a class as such:

class MyClass:
    import cmymodule, mymodule
    def info (self):
        mymodule.import()
    def encrypt(self):
        mymodule.encrypt()
    def open(self):
        cmymodule.open()

    ........


??  Would that suffice?


"Wojciech Zabolotny" <wzab at ise.pw.edu.pl> wrote in message
news:Pine.LNX.3.96.991211120613.7565A-100000 at ipebio15.ise.pw.edu.pl...
> Hi All,
>
> I'm preparing a python extension module which is partially implemented as
> in "C" (cmymodule.c), and partially in python (mymodule.py).
> I'd like to have functions defined in both files in the same namespace.
> Let's assume, that the functions are defined as follows:
> cmymodule.c:
> open, read, write, close
> mymodule.py:
> info, encrypt
>
> If I import both extensions into the user program, the functions should be
> called as cmy.open(), cmy.read(),... but my.info(), my.encrypt().
> If I include the "import cmy" into mymodule.py, then syntax will be even
> worse: my.cmy.open() and so on.
> Due to performace reasons I don't want to add the python "wrappers"
> in mymodule.py for C functions.
>
> How can I locate both C and python functions in the same namespace?
> Please Cc the answer to my e-mail (given below).
> --
>                         TIA
>                         Wojciech Zabolotny
>                         wzab at ise.pw.edu.pl
>                         http://www.ise.pw.edu.pl/~wzab
>
> http://www.freedos.org  Free DOS for free people!
>
>





More information about the Python-list mailing list