Noddy with submodules?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Sep 7 22:57:05 EDT 2009


En Mon, 07 Sep 2009 18:55:11 -0300, Torsten Mohr <tmohr at s.netic.de>
escribió:

> So i'd like to write a python module in C (which i did before some  
> times).
>
> But i'm not sure how i can create a module in a way that i can later do:
>
> import measurement
> import measurement.adc
> import measurement.adc.channels
> import measurement.pwm
>
> What do i need to do to create submodules within the initialisation code
> of a python module written in C?

I think it's easier to write a wrapper module in Python. See the xml.etree
package; the cElementTree.py Python module just contains "from
_elementtree import *" (_elementtree being a C extension)

-- 
Gabriel Genellina




More information about the Python-list mailing list