Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71740

Re: Loading modules from files through C++

References (6 earlier) <53778005.8030105@rptd.ch> <ll80dl$bov$1@ger.gmane.org> <53778E22.3040701@rptd.ch> <ll84s5$5bd$1@ger.gmane.org> <53790CCF.1070905@rptd.ch>
Date 2014-05-19 11:40 +1000
Subject Re: Loading modules from files through C++
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.10117.1400463653.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, May 19, 2014 at 5:41 AM, Roland Plüss <roland@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Loading modules from files through C++ Chris Angelico <rosuav@gmail.com> - 2014-05-19 11:40 +1000

csiph-web