[Python-Dev] What is the ":" for in python?

Barry Scott barry at barrys-emacs.org
Sat Feb 28 04:11:10 EST 2004


At 27-02-2004 19:39, Tom Emerson wrote:
>You could write
>
>if x > 10   \
>and x < 20:
>      do_in_range()

I don't like using backslash line continuation. Too many ways to mess up,
putting comments or white space after the \ may or may not work. And are
the continuation rules the same of C and make or different?

I cannot write:

if x > 10   \    # check lower bound
and x < 20:      # check upper bound
      do_in_range()

   File "L:\Users\barry\a.py", line 2
     if x > 10   \    # check lower bound
                                         ^
SyntaxError: invalid token

Barry





More information about the Python-Dev mailing list