[Python-Dev] Pasting interpreter prompts
Moshe Zadka
Moshe Zadka <mzadka@geocities.com>
Tue, 18 Apr 2000 08:55:20 +0200 (IST)
On Mon, 17 Apr 2000, Ka-Ping Yee wrote:
> One gripe that i hear a lot is that it's really difficult
> to cut and paste chunks of Python code when you're working
> with the interpreter because the ">>> " and "... " prompts
> keep getting in the way. Does anyone else often have or
> hear of this problem?
>
> Here is a suggested solution: for interactive mode only,
> the console maintains a flag "dropdots", initially false.
>
> After line = raw_input(">>> "):
> if line[:4] in [">>> ", "... "]:
> dropdots = 1
> line = line[4:]
> else:
> dropdots = 0
> interpret(line)
Python 1.5.2 (#1, Feb 21 2000, 14:52:33) [GCC 2.95.2 19991024 (release)]
on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a=[]
>>> a[
... ...
... ]
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: sequence index must be integer
>>>
Sorry.
--
Moshe Zadka <mzadka@geocities.com>.
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com