Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(especially': 0.07; 'bits': 0.09; 'exec': 0.09; 'project"': 0.09; 'subject:files': 0.09; 'subject:modules': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2),': 0.16; 'c/c++,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it;': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'stefan': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'integer': 0.24; 'unicode': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'code': 0.31; 'there.': 0.32; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'ram': 0.36; 'tech': 0.36; 'should': 0.36; 'rather': 0.38; 'worry': 0.60; 'soon': 0.63; 'more': 0.64; 'great': 0.65; 'doable': 0.84; 'etc,': 0.84; 'demand': 0.91; 'to:none': 0.92; 'imagine': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=RJNm7fS/TFZuVxQQ6o5KosGERxNVvviSifCdocav0w4=; b=r7Jc3cGRvgFr8WqSqAIGuhFAEHmeSn2suEI4cA8tsxiLlfRo3hFuGlB7oSUIvOd2/X 97644D5K98t+vruTApfyUw2ngq7H/+BjXx+q9SGwKJ2+7GfZylNG3pQhU+v12duMGJJn 7U5Is1YuzijytEr+cYp+l93F9K4Vg4xtARHog1E6BbjGi4BUdMKFAFtttm1bOhQAB6S7 YPU3BDPHg9iByjKkaTiUWfSFdZ5APVYQiaq9Rb8nMEr8NzHN2jry826zbusarysfpuRG /8kdCalYlaka1Gmr+sTycpN9E9kf522246uIKIF6AWi8wUqYn177AspZ6Wpuslc23A/0 AQEw== MIME-Version: 1.0 X-Received: by 10.58.112.8 with SMTP id im8mr3978166veb.35.1400463645489; Sun, 18 May 2014 18:40:45 -0700 (PDT) In-Reply-To: <53790CCF.1070905@rptd.ch> References: <5376ACE7.8030706@rptd.ch> <53775D68.2010009@rptd.ch> <537768FB.7060303@rptd.ch> <53778005.8030105@rptd.ch> <53778E22.3040701@rptd.ch> <53790CCF.1070905@rptd.ch> Date: Mon, 19 May 2014 11:40:45 +1000 Subject: Re: Loading modules from files through C++ From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400463653 news.xs4all.nl 2838 [2001:888:2000:d::a6]:43108 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71740 On Mon, May 19, 2014 at 5:41 AM, Roland Pl=C3=BCss 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