Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!newsfeed20.multikabel.net!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'beginner': 0.04; 'subject:bug': 0.04; 'interpreter': 0.05; 'parser': 0.05; 'complaining': 0.07; 'terry': 0.07; 'eof': 0.09; 'opening.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:string': 0.09; 'wrong,': 0.09; 'programmer': 0.10; 'am,': 0.12; "'hello": 0.16; '^^^': 0.16; 'bullet': 0.16; 'fix,': 0.16; 'literal,': 0.16; 'literals': 0.16; 'mean,': 0.16; 'mode.': 0.16; 'reedy': 0.16; 'span': 0.16; 'subject:handling': 0.16; 'this:': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'errors,': 0.18; 'string,': 0.18; 'say,': 0.19; 'trying': 0.21; 'programming': 0.21; 'have,': 0.21; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'figure': 0.23; 'accidentally': 0.23; 'literal': 0.23; 'topic.': 0.23; 'starts': 0.24; 'string': 0.24; 'command': 0.24; 'there.': 0.24; 'code.': 0.26; 'helpful': 0.26; 'missed': 0.28; 'coding': 0.28; '27,': 0.29; 'problem': 0.29; 'print': 0.29; 'error': 0.29; 'pm,': 0.29; 'agreed.': 0.30; 'cmd': 0.30; 'line:': 0.30; 'terminate': 0.30; 'people,': 0.32; 'pretty': 0.32; 'sort': 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'instead': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'question,': 0.34; 'too': 0.34; 'parse': 0.34; 'subject:work': 0.34; 'supposed': 0.35; 'problem.': 0.36; 'received:au': 0.36; '...': 0.36; 'subject:with': 0.36; 'but': 0.37; 'passed': 0.37; 'hello,': 0.37; 'think': 0.37; 'received:org': 0.38; 'easier': 0.38; 'fail': 0.39; 'difficult': 0.39; 'should': 0.39; 'johnson': 0.39; 'why': 0.39; 'subject: (': 0.40; 'to:addr:python.org': 0.40; 'once': 0.60; 'more': 0.61; 'harder': 0.64; 'here': 0.65; 'here:': 0.66; 'show': 0.67; '11:57': 0.84; 'closes,': 0.84; 'drops': 0.84; 'head!': 0.84; 'paragraphs': 0.84; 'print.': 0.84; 'subject:Possible': 0.84; 'ubiquitous': 0.84; 'fuck': 0.93; 'received:110': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lie Ryan Subject: Re: Possible bug in string handling (with kludgy work-around) Date: Thu, 29 Dec 2011 04:54:05 +1100 References: <4ef91afb$0$29973$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 110-175-240-90.static.tpgi.com.au User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325094872 news.xs4all.nl 6989 [2001:888:2000:d::a6]:57730 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18131 On 12/28/2011 11:57 AM, Rick Johnson wrote: > On Dec 27, 3:38 pm, Terry Reedy wrote: >> On 12/27/2011 1:04 PM, Rick Johnson wrote: >> >>> But this brings up a very important topic. Why do we even need triple >>> quote string literals to span multiple lines? Good question, and one i >>> have never really mused on until now. >> >> I have, and the reason I thought of is that people, including me, too >> ofter forget or accidentally fail to properly close a string literal, > > Yes, agreed. > >> Color coding editors make it easier to catch such errors, but they were >> less common in 1991. > > I would say the need for triple quote strings has passed long ago. > Like you say, since color lexers are ubiquitous now we don't need > them. > >> And there is still uncolored interactive mode. > > I don't see interactive command line programming as a problem. I mean, > who drops into a cmd line and starts writing paragraphs of string > literals? Typically, one would just make a few one-liner calls here or > there. Also, un-terminated string literal errors can be very > aggravating. Not because they are difficult to fix, no, but because > they are difficult to find! -- and sending me an error message > like... > > "Exception: Un-terminated string literal meets EOF! line: 50,466,638" > > ... is about as helpful as a bullet in my head! > > If the interpreter finds itself at EOF BEFORE a string closes, don't > you think it would be more helpful to include the currently "opened" > strings START POSITION also? No it wouldn't. Once you get an unterminated string literal, the string would terminate at the next string opening. Then it would fuck the parser since it will try to parse what was supposed to be a string literal as a code. For example: hello = 'bar' s = "boo, I missed a quote here print 'hello = ', hello, "; s = ", s the parser would misleadingly show that you have an unclosed string literal here: vvv print 'hello = ', hello, "; s = ", s ^^^ instead of on line 2. While an experienced programmer should be able to figure out what's wrong, I can see a beginner programmer trying to "fix" the problem like this: print 'hello = ', hello, "; s = ", s" and then complaining that print doesn't print. Limiting string literals to one line limits the possibility of damage to a single line. You will still have the same problem if you missed to close triple-quoted string, but since triple-quoted string are much rarer and they're pretty eye-catching, this sort of error harder are much harder.