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


Groups > comp.lang.python > #43192

Re: standalone vs embedded interpreter

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; 'say,': 0.05; '(python': 0.07; "'a'": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'question.': 0.14; 'windows': 0.15; 'behave': 0.16; 'from:addr:pitrou.net': 0.16; 'from:addr:solipsis': 0.16; 'from:name:antoine pitrou': 0.16; 'interpreter,': 0.16; 'message-id:@post.gmane.org': 0.16; 'nick': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stdout': 0.16; '>>>': 0.22; 'input': 0.22; 'header:User- Agent:1': 0.23; 'handling': 0.26; 'holds': 0.26; 'code:': 0.26; 'header:X-Complaints-To:1': 0.27; 'code': 0.31; '(my': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'probably': 0.32; 'linux': 0.33; 'running': 0.33; 'case,': 0.35; 'but': 0.35; 'doing': 0.36; 'charset:us-ascii': 0.36; '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; 'skip:p 20': 0.39; 'received:org': 0.40; 'different': 0.65; 'prompt': 0.68; 'press': 0.70; 'behavior': 0.77; '3.3.1': 0.84; 'antoine.': 0.84; '2013,': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Antoine Pitrou <solipsis@pitrou.net>
Subject Re: standalone vs embedded interpreter
Date Tue, 9 Apr 2013 16:13:15 +0000 (UTC)
References <516434C9.6020705@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host sea.gmane.org
User-Agent Loom/3.14 (http://gmane.org/)
X-Loom-IP 88.163.232.20 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0)
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.360.1365524014.3114.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365524014 news.xs4all.nl 2621 [2001:888:2000:d::a6]:46183
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43192

Show key headers only | View raw


Nick Gnedin <ngnedin <at> gmail.com> writes:
> 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?

Are stdin and stdout both interactive? That is, are isatty(fileno(stdin))
and isatty(fileno(stdout)) both true?

If you want to debug, take a look at PyOS_Readline() in Parser/myreadline.c.
It probably holds the answer to your question.

Regards

Antoine.

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


Thread

Re: standalone vs embedded interpreter Antoine Pitrou <solipsis@pitrou.net> - 2013-04-09 16:13 +0000

csiph-web