On 7 feb, 15:04, Heiko Wundram <modeln...@modelnine.org> wrote:
> Am 07.02.2012 14:48, schrieb Antti J Ylikoski:
>
> > On 7.2.2012 14:13, Jean Dupont wrote:
> >> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
> >> rtscts=0, dsrdtr=0, timeout=15)
>
> > In Python, if you want to continue the source line into the next text
> > line, you must end the line to be continued with a backslash '\'.
>
> Absolutely not true, and this is bad advice (stylistically).
>
> When (any form of) brackets are open at the end of a line, Python does
> not start a new command on the next line but rather continues the
> backeted content.
>
> So:
>
> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
>                       rtscts=0, dsrdtr=0, timeout=15)
>
> is perfectly fine and certainly the recommended way of putting this.
>
> Adding the backslash-continuation is always _possible_, but only
> _required_ when there are no open brackets.
>
> So:
>
> x = "hello" \
>      " test"
>
> is equivalent to:
>
> x = ("hello"
>       " test")
>
> in assigning:
>
> x = "hello test"
>
> --
> --- Heiko.

Hello to all who gave advice concerning the line continuation, in fact
this was not a real problem but happened by accident
copying and pasting my program lines. Advice concerning the empty file
would of course also be very much appreciated.

thanks,
Jean
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to