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


Groups > comp.lang.python > #71767

Re: Loading modules from files through C++

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <roland@rptd.ch>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'scripts': 0.03; 'programmer': 0.03; 'interpreter': 0.05; '(especially': 0.07; 'bits': 0.09; 'exec': 0.09; 'predefined': 0.09; 'project"': 0.09; 'subject:files': 0.09; 'subject:modules': 0.09; 'python': 0.11; '2),': 0.16; 'c/c++,': 0.16; 'class).': 0.16; 'filename:fname piece:signature': 0.16; 'it;': 0.16; 'received:192.168.1.20': 0.16; 'url:ch': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'stefan': 0.19; 'seems': 0.21; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'unicode': 0.24; 'mon,': 0.24; '(or': 0.24; 'question': 0.24; 'script': 0.25; 'push': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; '(which': 0.31; 'code': 0.31; 'url:wiki': 0.31; 'dropped': 0.31; 'loading': 0.31; 'file': 0.32; 'there.': 0.32; 'figure': 0.32; 'run': 0.32; 'subject:from': 0.34; "can't": 0.35; 'problem.': 0.35; 'but': 0.35; 'there': 0.35; 'c++': 0.36; 'ram': 0.36; 'tech': 0.36; 'done': 0.36; 'doing': 0.36; 'possible': 0.36; 'should': 0.36; 'actions': 0.38; 'handle': 0.38; 'to:addr:python- list': 0.38; 'rather': 0.38; '(from': 0.39; 'embedded': 0.39; 'launch': 0.39; 'to:addr:python.org': 0.39; 'und': 0.40; 'how': 0.40; 'worry': 0.60; 'from:charset:utf-8': 0.61; 'simply': 0.61; 'first': 0.61; 'reach': 0.63; 'soon': 0.63; 'sincerely': 0.63; 'map': 0.64; 'more': 0.64; 'great': 0.65; 'kept': 0.65; 'land': 0.65; 'export': 0.74; 'doable': 0.84; 'etc,': 0.84; 'utmost': 0.84; 'url:php': 0.85; 'yours': 0.88; 'demand': 0.91; 'involved.': 0.91; 'imagine': 0.93; 'obtained': 0.96
Date Mon, 19 May 2014 18:37:46 +0200
From Roland Plüss <roland@rptd.ch>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Loading modules from files through C++
References <5376ACE7.8030706@rptd.ch> <ll7iu1$oge$1@ger.gmane.org> <53775D68.2010009@rptd.ch> <ll7o30$pc3$1@ger.gmane.org> <537768FB.7060303@rptd.ch> <ll7q3m$idv$1@ger.gmane.org> <53778005.8030105@rptd.ch> <ll80dl$bov$1@ger.gmane.org> <53778E22.3040701@rptd.ch> <ll84s5$5bd$1@ger.gmane.org> <53790CCF.1070905@rptd.ch> <CAPTjJmrOeSsmoxqk8iCL2tKEX9Qa1yHBLzfbfvNr_7Ap+AP6pg@mail.gmail.com>
In-Reply-To <CAPTjJmrOeSsmoxqk8iCL2tKEX9Qa1yHBLzfbfvNr_7Ap+AP6pg@mail.gmail.com>
X-Enigmail-Version 1.6
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fLn3CLhNCa5EDBr7So7k3lT8pcgpsauQ"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10139.1400517468.18130.python-list@python.org> (permalink)
Lines 69
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1400517468 news.xs4all.nl 2872 [2001:888:2000:d::a6]:39751
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71767

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 05/19/2014 03:40 AM, Chris Angelico wrote:
> 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
Cython is out of question since link time dependencies has to be kept at
an utmost minimum. An concerning doing things from python code it's
simply not possible (or I don't know how this should work). Python is
fully embedded including any file actions (virtual file system). The
launch comes from C++ land. No interpreter is involved. The main work is
done outside Python and only dropped in python to do higher logic. This
also means the very first python code run requires a C++ script file
loading before this first code can ever run. I can't run code that
doesn't yet exist in the reach of the python VM. That's the main
problem. This is why I need to figure out how to push that first code
into Python in a way I can construct an object (from a predefined
class). From there on all calls into Python land are solely done trough
function calls on this one object obtained in the beginning. I see no
other way to handle the problem.

-- 
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- As well as various Blender export scripts und game tools

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


Thread

Re: Loading modules from files through C++ Roland Plüss <roland@rptd.ch> - 2014-05-19 18:37 +0200

csiph-web