inclusive-lower-bound, exclusive-upper-bound (was Re: Range Operation pre-PEP)

Delaney, Timothy tdelaney at avaya.com
Tue May 15 21:25:13 EDT 2001


> [Greg Ewing]
> > * Allow implicit line continuations anywhere you have what
> >   is obviously a syntactically incomplete structure (e.g.
> >   an expression ending with a binary operator).
> 
> [Andrew Maizels]
> > I've thought about that, but I'm not sure how well this 
> will fly with
> > the average programmer.  I think Icon does this.

> Note that Python used to require explicit continuation on 
> every continued
> line.  Implicit continuation was added later (when in the midst of an
> unclosed bracketing-- ({[ --structure).  That change was more 
> popular even
> than adding ">>" to "print" <wink>.
> 
> The odd thing is you can't win:  people will screw up no 
> matter what you do
> about this, until there's a smart language-aware editor.

My feeling on this is that *any* syntactically-incomplete statement should
be allowed to extend to the next line. For example, any statement which
requires a colon at the end (for, if, etc).

if a == 1
   and b == 2 and
   c in [
        1,
        2,
        3
   ]:
    do_something()

There we have two syntactically-incomplete statements: the list, and the
if:.

However, there may well be situations I haven't thought of where such a rule
would cause semantic differences - can anyone think of any?

Tim Delaney




More information about the Python-list mailing list