Bug or feature: double strings as one
Jan Kaliszewski
zuo at chopin.edu.pl
Sat Aug 8 13:43:30 EDT 2009
08-08-2009 Steven D'Aprano <steve at remove-this-cybersource.com.au> wrote:
> On Fri, 07 Aug 2009 17:35:28 +0000, kj wrote:
>
>> I fail to see why
>>
>> x = ("first part of a very long string "
>> "second part of a very long string")
>
> That's done by the compiler at compile time and is fast.
Moreover, it's also more readable, when you use str calling its
methods or using formatting on it.
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).
*j
--
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>
More information about the Python-list
mailing list