assigning multi-line strings to variables
Alf P. Steinbach
alfps at start.no
Fri Apr 30 18:03:37 EDT 2010
On 30.04.2010 21:40, * Lie Ryan:
> On 05/01/10 04:08, Neil Cerutti wrote:
>> On 2010-04-30, Lie Ryan<lie.1296 at gmail.com> wrote:
>>> Use triple-quoted, let them flow, done. I've never heard of any
>>> text editor in current use without text wrapping capability,
>>> even Notepad has it. And if I've got 5k of text in source code
>>> without line breaks I wouldn't want that silly string to
>>> disturb my view of the code. You argument aren't even
>>> convincing.
>>>
>>> Perhaps you like to do it the hard way, I don't.
>>
>> Arguing about how to write 5k of text into your code is about as
>> sensible as arguing about how to stuff a potato into the tailpipe
>> of your Chevrolet.
>>
>>> The point is, what you're suggesting doesn't save work at all
>>> as you've shown it. There are other ways to do the same thing,
>>> for virtually no work at all.
>>
>> Don't put big text dumps in your program. Problem solved!
>>
>
> Alf suggested it, not me.
On the contrary, I responded to you on the 30th, using a concrete example of
your triple-quote literals rationale posted on the 29th, that ...
<quote author="Lie Ryan">
Yes, apparently my statement that implicit concatenation is an artifact
is erroneous but it doesn't make the important points less true, that
implicit concatenation is not suitable for integrating large chunk of
text into source code.
</quote
... but I may have misunderstood what you meant by "large".
Anyway, if you read my first posting in this thread you'll see that the first
thing I suggested is to put the text in a separate text file.
I didn't discuss rationales for choosing this or that method because where it
isn't personal preference it's rather obvious. ;-)
Cheers & hth,
- Alf
More information about the Python-list
mailing list