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


Groups > comp.lang.python > #3458

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

From harrismh777 <harrismh777@charter.net>
Newsgroups comp.lang.python
Subject Re: [Q] ipython: Multiple commands on the same line and newlines
References <8dc6c9e4-e50e-401f-95d9-42f80a90196c@l30g2000vbn.googlegroups.com> <mailman.436.1302972019.9059.python-list@python.org>
Message-ID <VsQqp.9358$vC5.5966@newsfe01.iad> (permalink)
Date 2011-04-18 01:01 -0500

Show all headers | View raw


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;<ctrl-enter>
>
> This is one statement

>> while x<  10:<ctrl-enter>
>>      x = x + 1;<ctrl-enter>


Lutz has a very nice write-up entitled "Why Indentation Syntax?"

Lutz, Mark, "Learning Python: Powerful Object Oriented Programming,"
     4th ed, (Sebastopol: O'Reilly, 2009), 266 -271.

     He makes the point clear that only simple statements may be chained 
together on a single line with  ;  and that compound statements (like 
while) "must still appear on lines of their own" (Lutz, 269).

     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-like) blocking syntax.

     The forced indentation syntax is great for readability (and 
frankly, I like the appearance /low clutter) but it is inconvenient in 
some situations, like the one at the top of the thread.

     Just an idea (probably already been beaten to death long before my 
time)   :)

kind regards,
m harris

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


Thread

[Q] ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-16 06:55 -0700
  Re: [Q] ipython: Multiple commands on the same line and newlines Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-04-16 18:29 +0200
    Re: ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-16 09:37 -0700
      Re: ipython: Multiple commands on the same line and newlines Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-04-17 14:11 +0200
        Re: ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-17 11:40 -0700
          Re: ipython: Multiple commands on the same line and newlines Alexander Kapps <alex.kapps@web.de> - 2011-04-17 21:39 +0200
  Re: [Q] ipython: Multiple commands on the same line and newlines Chris Angelico <rosuav@gmail.com> - 2011-04-17 02:33 +1000
  Re: [Q] ipython: Multiple commands on the same line and newlines Terry Reedy <tjreedy@udel.edu> - 2011-04-16 12:39 -0400
    Re: [Q] ipython: Multiple commands on the same line and newlines harrismh777 <harrismh777@charter.net> - 2011-04-18 01:01 -0500
      Re: [Q] ipython: Multiple commands on the same line and newlines Chris Angelico <rosuav@gmail.com> - 2011-04-18 16:12 +1000
  Re: [Q] ipython: Multiple commands on the same line and newlines "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-04-17 04:22 +0000

csiph-web