Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43185
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ngnedin@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'interpreter': 0.05; 'say,': 0.05; '(python': 0.07; '#include': 0.09; "'a'": 0.09; 'main()': 0.09; 'windows': 0.15; 'behave': 0.16; 'folks,': 0.16; 'interpreter,': 0.16; 'nick': 0.16; '>>>': 0.22; 'input': 0.22; 'header:User-Agent:1': 0.23; 'handling': 0.26; 'code:': 0.26; 'skip:p 30': 0.29; 'code': 0.31; 'received:10.0.0': 0.31; '(my': 0.31; 'embed': 0.31; 'anyone': 0.31; 'linux': 0.33; 'running': 0.33; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'thanks': 0.36; 'received:10.0': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'hat': 0.38; 'to:addr:python-list': 0.38; 'previous': 0.38; 'expect': 0.39; 'does': 0.39; 'embedded': 0.39; 'to:addr:python.org': 0.39; 'simply': 0.61; 'different': 0.65; 'prompt': 0.68; 'press': 0.70; 'behavior': 0.77; '3.3.1': 0.84; '2013,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=9YFR+RQuXj5iZ++PhrYNex5nmGyDZ26IHTxwYRKM4DY=; b=R2kKMTx9QeOC/3y6oMcwQqodHStQ/NARBsGFIbqT6hali76Ura8a5R65ew+I+jpPfj H+37/4vDg0c1qCbuokHXf6O/w4RZ9US2WyA4V6kfZC8nDecNc4Z4aypKrnIqqKM0/wv6 +fQa64AeVl6zUNUxnLfMf+aPfltfvSY8zfDy78qxJbSSrbeylXZFsKg7rwzM1SIBJB9L 6WFzCd9PF724fRiw8+hkQw5eKJ3jRp7K5PXGopFqOxxWQzl3tff/A5/p8ZX+xc+7dtdy JMiGadOFJ3Owl8P0LQrRPpQ6WrUjRtQq8mgtnVAi0F5ZD3BdhvsSQJsX3Siv97I2I3nG iJiA== |
| X-Received | by 10.50.180.197 with SMTP id dq5mr10244335igc.22.1365521612585; Tue, 09 Apr 2013 08:33:32 -0700 (PDT) |
| Date | Tue, 09 Apr 2013 10:33:29 -0500 |
| From | Nick Gnedin <ngnedin@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | standalone vs embedded interpreter |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.355.1365521615.3114.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365521615 news.xs4all.nl 2691 [2001:888:2000:d::a6]:45565 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43185 |
Show key headers only | View raw
Folks,
When simply I embed the interpreter:
#include "Python.h"
int main()
{
Py_Initialize();
PyRun_InteractiveLoop(stdin,"test");
Py_Finalize();
return 0;
}
I expect it to behave the same way as if I was running it as a
standalone program. On Windows this is indeed the case, but on my Linux
box (Python 3.3.1 (default, Apr 8 2013, 22:33:31) [GCC 4.1.2 20080704
(Red Hat 4.1.2-51)]) I get a different behavior in handling console
input. A standalone interpreter cycles though the input history when I
use up and down arrows - say, I type this code:
>>> 1
1
>>> a=4
>>> a
4
If I now press an <up> key in a standalone interpreter, I get 'a' placed
at the prompt (my previous command). However, in an embedded code I get
>>> ^[[A
put at the prompt - does anyone know what I am doing wrong?
Many thanks for any hint,
Nick
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
standalone vs embedded interpreter Nick Gnedin <ngnedin@gmail.com> - 2013-04-09 10:33 -0500
Re: standalone vs embedded interpreter rusi <rustompmody@gmail.com> - 2013-04-09 08:52 -0700
Re: standalone vs embedded interpreter Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:14 +1000
csiph-web