Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Chris Angelico
On Mon, Apr 18, 2011 at 4:01 PM, harrismh777 wrote: >    It might be nice (as an option) to be able to disengage the forced > indentation syntax rules of Python. In other words, provide indentation > syntax by default and allow an option via environment variable to engage an > alternate (more C-li

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-17 Thread harrismh777
Terry Reedy wrote: You can write multiple *simple* statements using ';'. All compound statements, like while, must start on own line. E.g. I want: "x = 0; This is one statement while x< 10: x = x + 1; Lutz has a very nice write-up entitled "Why Indentation Syntax?" Lutz, Mark

Re: ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Rajendra prasad Gottipati
Phil, there is one more way you can run all commands as in linux shell.. >>> import commands >>> s, o = commands.getstatusoutput('x=10;for i in $(seq $x); do echo $i ; done') >>> print o 1 2 3 4 5 6 7 8 9 10 >>> On Sun, Apr 17, 2011 at 11:40 AM, Phil Winder wrote: > On Apr 17, 1:11 pm, Andrea C

Re: ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Alexander Kapps
On 17.04.2011 20:40, Phil Winder wrote: Ok, thanks all. It's a little disappointing, but I guess that you always have to work in a different way when you move to a new language. Andrea's %edit method is probably the best compromise, but this now means that I will have to learn all the (obscure) s

Re: ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Phil Winder
On Apr 17, 1:11 pm, Andrea Crotti wrote: > Phil Winder writes: > > Yes, that does not produce an error, but it does not "work". Please > > refer to my first post. Try the first code, you will get a syntax > > error. Placing things on one line makes for easy history scrollback. > > In your version

Re: ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Andrea Crotti
Phil Winder writes: > Yes, that does not produce an error, but it does not "work". Please > refer to my first post. Try the first code, you will get a syntax > error. Placing things on one line makes for easy history scrollback. > In your version you will have 2 lines of history for the x = 0 ter

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread OKB (not okblacke)
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

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread wisecracker
Hi Phil... > 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. I don`t think this is possible under any Python version. There will always be some kind of user intervention required other th

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Terry Reedy
On 4/16/2011 9:55 AM, 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 lin

Re: ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Phil Winder
On Apr 16, 5:29 pm, Andrea Crotti wrote: > Phil Winder writes: > > 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 writ

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 2:29 AM, Andrea Crotti wrote: > for > x = 10 > > what's the difference for you if it gets evaluated before or after? I have the same issue in IDLE sometimes, and the reason it's annoying relates to the up-arrow key (Alt-P in IDLE). I can retrieve one entire command, but if

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Andrea Crotti
Phil Winder writes: > 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. "

[Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Phil Winder
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;" r