assigning multi-line strings to variables
lie.1296 at gmail.com
Fri Apr 30 13:31:17 EDT 2010
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 start.no> wrote:
>>>>> On 28.04.2010 18:54, * Lie Ryan:
>>>>>> Python have triple-quoted string when you want to include large
>>>>>> 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.
Perhaps you like to do it the hard way, I don't.
>> Yes, your advices works perfectly if you follow it; except that it adds
>> something to my worklist instead of lifting it.
> No, you simply haven't thought it through.
> I suspect that you have formed some silly idea in your mind about what I
> wrote meant, and that that in-your-mind silly idea is what you're
> arguing against, for otherwise your comments do not make sense (like,
> you state that saving work adds work).
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.
More information about the Python-list