Part C, Part Python Module?
WP
warrenpstma at _______.com.hotmail
Tue Feb 25 09:49:29 EST 2003
John Abel wrote:
> Hi,
>
> I am in the process of writing a module, and now need to code some parts
> of it in C. Is it possible to have them both imported using the same
> name? Or, will I have to import the C-based module in the Python module?
Because C and Python are so very different in nature, it seems the traditional approach is to treat C as an 'extension/accelerator' language, which you 'wrap'
in python. For example, a low level C extension that parses some file format would be a natural, and it could be wrapped by a higher-level, typically more
object oriented Python wrapper. So, if you are thinking of them as having the same name, perhaps you could follow the 'leading underscore' idea
(socket,_socket), so that the C is shown to be more internal or low level (the underscore).
Warren
More information about the Python-list
mailing list