Bug or feature: double strings as one

r rt8396 at gmail.com
Sun Aug 9 18:04:48 CEST 2009


On Aug 8, 12:43 pm, "Jan Kaliszewski" <z... at chopin.edu.pl> wrote:
> 08-08-2009 Steven D'Aprano <st... at remove-this-cybersource.com.au> wrote:
...(snip)
> I use it very often, e.g.:
>
>          afunction('quite long string %s quite long string '
>                    'quite long string quite long string %s '
>                    'quite %s long string quite long string'
>                    % (variable1, variable2, variable3))
>
> It seems nicer to me than:
>
>          afunction(('quite long string %s quite long string '
>                     + 'quite long string quite long string %s '
>                     + 'quite %s long string quite long string')
>                    % (variable1, variable2, variable3))
>
> (Note that multiline-'''-strings are usless in such cases).
>

uhh? A much better way to handle such a problem is like this...

prompt1 = '''
Some people like to use %s
ways of doing things just
so they can support their %s
way of coding
'''

afunction(prompt1 %(var1, var2))

WOW!, that just somehow looks more professional to me? I hate to long
strings in the middle of a code block. Please be smart when writing
code people!!




More information about the Python-list mailing list