Re: the war on trailing whitespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Ericsson wrote:
> Uwe Zeisberger wrote:
> >Hello,
> >
> >Andreas Ericsson wrote:
> >
> >>I think the question is whether completely empty lines are also ignored 
> >>by Python, or if they start a new block of code. Whatever the case, it 
> >>must hold true for both 2.3 and 2.4.
> >
> >see
> >	http://www.python.org/doc/2.2.3/ref/blank-lines.html
> >	http://www.python.org/doc/2.3.5/ref/blank-lines.html
> >	http://www.python.org/doc/2.4.2/ref/blank-lines.html
> >
> 
> So in essence, a multi-line statement is closed when a completely empty 
> line is found,
Wrong.

A logical line that contains only spaces, tabs, formfeeds and possibly a
comment, is ignored (i.e., no NEWLINE token is generated). During
interactive input of statements, handling of a blank line may differ
depending on the implementation of the read-eval-print loop. In the
standard implementation, an entirely blank logical line (i.e. one
containing not even whitespace or a comment) terminates a multi-line
statement.

To translate that to python:

  if not interactive:
    a line only containing whitespace is ignored.
  else:
    if standard implementation:
      empty line terminates multi-line statement
    else:
      dependent on implementation

i.e. In scripts, lines containing only (zero or more) whitespaces are
ignored.

hth
Uwe

-- 
Uwe Zeisberger

Set the I_WANT_A_BROKEN_PS environment variable to force BSD syntax ...
	-- manpage of procps
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]