[Tutor] continuation lines
Marilyn Davis
marilyn at deliberate.com
Tue Nov 2 00:21:46 CET 2004
Thank you!
On Mon, 1 Nov 2004, Kent Johnson wrote:
> At 01:36 PM 11/1/2004 -0800, Marilyn Davis wrote:
> >And another thing, when, in Python code, can I hit the return key
> >mid-statement? After a ',', and when else? I've sort of given up
> >trying to break up statements.
>
> You can break a line whenever you have an open parenthesis (, brace { or
> bracket [
> eg
>
> lst = [
> 'stuff',
> 'morestuff'
> ]
>
> myDict = {
> 'a' : 1,
> 'b' : 2
> }
>
> callOfFunctionWithVeryManyArguments('arg1', 'arg2',
> 'arg3', 'arg4')
>
> You can explicitly continue a line by ending it with a \
> x = a + \
> b
>
> You can include line breaks inside triple-quoted strings:
> s = '''Here is some text
> that spans two lines'''
>
> Kent
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
More information about the Tutor
mailing list