Loading modules from files through C++

Chris Angelico rosuav at gmail.com
Sun May 18 21:40:45 EDT 2014


On Mon, May 19, 2014 at 5:41 AM, Roland Plüss <roland at rptd.ch> wrote:
> This exec source_code in module.__dict__ , should this not also be doable
> with PyEval_EvalCode?

General principle: The more code you write in Python and the less in
C/C++, the happier and more productive you will be.

Drop into Python as soon as you can, and do all the work from there.
You won't have to worry about RAM (de)allocation, Unicode (especially
if you use Python 3 rather than 2), integer overflow, etc, etc, etc.
Only write lower-level code for the bits that actually demand it; and
as Stefan has pointed out, Cython is a great help there.

(Which reminds me. I still need some "excuse project" to justify my
learning Cython. It's good-looking tech but everything I can imagine
writing seems to already exist.)

ChrisA



More information about the Python-list mailing list