assigning multi-line strings to variables

Alf P. Steinbach alfps at
Fri Apr 30 19:56:01 CEST 2010

On 30.04.2010 19:31, * Lie Ryan:
> On 05/01/10 00:01, Alf P. Steinbach wrote:
>> On 30.04.2010 12:51, * Lie Ryan:
>>> On 04/30/10 12:07, Alf P. Steinbach wrote:
>>>> On 30.04.2010 01:29, * Carl Banks:
>>>>> On Apr 28, 11:16 am, "Alf P. Steinbach"<al... at>    wrote:
>>>>>> On 28.04.2010 18:54, * Lie Ryan:
>>>>>>> Python have triple-quoted string when you want to include large
>>>>>>> amount
>>>>>>> of text;
>>>>>> Yes, that's been mentioned umpteen times in this thread, including
>>>>>> the *very
>>>>>> first* quoted sentence above.
>>>>>> It's IMHO sort of needless to repeat that after quoting it, and
>>>>>> providing yet
>>>>>> another example right after quoting an example.
>>>>>> Probably you didn't notice?
>>>>> I think he repeated it just to let people know that they can get what
>>>>> they want without following your adsurd advice.
>>>> Perhaps you could quote the advice that you find absurd, and explain how
>>>> you interpret the quoted text?
>>>> My previous experience with you is that you immediately called me
>>>> "insane" (and worse) for suggesting a solution that could work in
>>>> principle and did work in practice for the problem posed in that thread;
>>>> I think you resorted to such characterizations because you had stated
>>>> that it was impossible.
>>> I don't know about your feud with Carl, but for this particular thread,
>>> the problem is that your solution involves much more manual work than is
>>> necessary. Even worse, you suggested to "write a Python script to format
>>> it for you". That is the worse piece of advice I've ever heard.
>> If you have a 5K string without line breaks, say, then it's entirely
>> reasonable to write a script to split it up, depending on your fav
>> editor's lack of functionality for that. Perhaps you'd like to do it
>> manually. I don't.
> 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.

You'd put a 5K line in your source code, + you're working with text wrapping in 
your editor.


Cheers & hth.,

- Alf

More information about the Python-list mailing list