Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "OKB (not okblacke)" Newsgroups: comp.lang.python Subject: Re: [Q] ipython: Multiple commands on the same line and newlines Date: Sun, 17 Apr 2011 04:22:38 +0000 (UTC) Organization: A noiseless patient Spider Lines: 33 Message-ID: References: <8dc6c9e4-e50e-401f-95d9-42f80a90196c@l30g2000vbn.googlegroups.com> Injection-Date: Sun, 17 Apr 2011 04:22:38 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="VBRx1jzaPYmS2Pb8loN3ww"; logging-data="3148"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ruAXGz3Lz53+Ym+pznHbKWu+xC6sTKrc=" User-Agent: Xnews/5.04.25 X-Face: ^]|0#B-HZs' Cancel-Lock: sha1:+biO/wrTZ1T2lF/R8M5AR0QnX4c= Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3369 Phil Winder wrote: > Hi, > I'm having a go at using ipython as a command prompt for data > analysis. Coming from Matlab, I'm used to typing multiple commands on > the same line then using the up arrow to go through my history. > How can I write multiple python commands on the same line? > E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax" > error on the 'e' in while. > > Also, how can I produce a new line, without it running the command? I > would have expected a ctrl-enter or shift-enter to produce the > expected results. > E.g. I want: > "x = 0; > while x < 10: > x = x + 1; > " > It seems to work automatically for the "while xxx:", but combinations > of keys+enter do not work for "normal" lines. You might want to take a look at DreamPie ( http://dreampie.sourceforge.net/ ), which provides the second option you indicate (and thus makesthe first unnecessary). I've found it quite convenient for interactive use. -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail." --author unknown