[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: python-mode: make sure output is not eaten
From: |
Ken Manheimer |
Subject: |
Re: python-mode: make sure output is not eaten |
Date: |
Fri, 25 Aug 2006 15:53:56 -0400 |
On 8/24/06, Steven Huwig <address@hidden> wrote:
On Aug 23, 2006, at 12:04 AM, Stefan Monnier wrote:
>
> Yes, of course. BTW do you have any idea why the current code uses
> "\n\n"?
Might it be because the Python interactive interpreter needs the extra
newline due to significant whitespace? E.g.
>>> for i in range(1,5):
... print i,
...
1 2 3 4
i haven't looked at the code in question, but have a salient point to
offer. the handling of interactively entered python code is different
than the processing of source code from a file, specifically in that
the end of top-level blocks is detected by an empty line of input.
this is necessary because, during interaction, you don't want to
require people to enter the first line of the subsequent top-level
construct to determine that the previous top-level construct has
concluded. instead, it's assumed they've concluded when an empty line
is encountered.
i suspect that the "\n\n" you all are referring to is specifically to
provide that newline.
a DEDENT token is created by the unindented second newline, closing
the block. A single newline cannot do that as it is also the
statement terminator.
... and a double newline doesn't have this effect for file input,
where the interpreter/compiler *can* wait for the first line of the
next top-level construct, or end-of-file.
> [...]
--
ken
address@hidden
http://myriadicity.net
- python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/21
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/22
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/22
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/24
- Re: python-mode: make sure output is not eaten, Steven Huwig, 2006/08/24
- Re: python-mode: make sure output is not eaten, Steven Huwig, 2006/08/24
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/25
- Re: python-mode: make sure output is not eaten, Steven Huwig, 2006/08/25
- Re: python-mode: make sure output is not eaten,
Ken Manheimer <=
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/25
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/25
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/25
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/26
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/26
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/26
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/28
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/30
- Re: python-mode: make sure output is not eaten, Stefan Monnier, 2006/08/30
- Re: python-mode: make sure output is not eaten, Slawomir Nowaczyk, 2006/08/31