Newbie: Looking for code review on my first Python project.

Terry Reedy tjreedy at udel.edu
Tue Jan 10 22:59:23 EST 2012


On 1/10/2012 8:43 PM, Chris Angelico wrote:

> about = "Built by Walter Hurry using Python and wxPython,\n" + \
>          "with wxGlade to generate the code for the GUI elements.\n" + \
>          "Phil Lewis' get_iplayer does the real work.\n\n" + \
>          "Version 1.05: January 10, 2012"
>
> I'd do this with a triple-quoted string:
>
> about = """Built by Walter Hurry using Python and wxPython,
> with wxGlade to generate the code for the GUI elements.
> Phil Lewis' get_iplayer does the real work.

I would too, but if you prefer the indentation, just leave out the '+'s 
and let Python do the catenation when compiling:
 >>> s = "abc\n" \
     "def\n"\
     "ghi"
 >>> s
'abc\ndef\nghi'

-- 
Terry Jan Reedy




More information about the Python-list mailing list