Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.03; 'string.': 0.04; 'suppose': 0.05; 'programmers,': 0.07; 'delimiter': 0.09; 'subject:string': 0.09; 'am,': 0.12; '(note': 0.16; 'apostrophe': 0.16; 'confusing.': 0.16; 'delimiters': 0.16; 'general.': 0.16; 'intended.': 0.16; 'nest': 0.16; 'nesting': 0.16; 'parentheses': 0.16; "wouldn't": 0.17; 'wed,': 0.17; 'wrote:': 0.18; 'programming': 0.21; 'dec': 0.22; '(or': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'statement': 0.23; 'replacing': 0.23; 'string': 0.24; 'code': 0.25; 'message-id:@mail.gmail.com': 0.28; 'pm,': 0.29; 'generally': 0.30; 'outer': 0.30; 'received:209.85.210.46': 0.30; 'received:mail- pz0-f46.google.com': 0.30; 'chris': 0.30; 'thu,': 0.32; 'pretty': 0.32; "can't": 0.32; 'there': 0.33; 'rules': 0.34; 'to:addr :python-list': 0.34; 'nested': 0.34; 'parse': 0.34; 'issue': 0.35; 'vice': 0.35; 'similar': 0.36; 'starting': 0.36; 'uses': 0.36; 'accuracy': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'received:209.85': 0.38; 'non': 0.38; 'difficult': 0.39; 'either': 0.39; 'everyone': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; '2011': 0.61; 'techniques': 0.64; 'guarantee': 0.65; 'manner': 0.65; 'subject:!': 0.67; 'intuitive': 0.67; '29,': 0.73; 'nathan': 0.84; 'realm': 0.84; 'examining': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=gBoFOj9ep3GOVlByQQ0vmBhoE+JQx4WF5LuJpXEd3z0=; b=djtQxHOWXYIFeGlMMNiPV7yWi0oVaKam6mTW32ulX5z7KQnNRg/NraG66oL/FgHuuz ZtDlgmIJbskWrDxXQ/NZKT/iwyfdcMpbyT2yRL9ZZfeqSnpgaIYZUYd0BZ0LFm8RuGhC xeUfwHVR+PsLNVhef+M9TMw7paN9qEWarOrLM= MIME-Version: 1.0 In-Reply-To: References: <280841b8-8674-4c1d-9a82-28982340a4b8@v24g2000yqk.googlegroups.com> <1325106214.5274.140661016836917@webmail.messagingengine.com> Date: Wed, 28 Dec 2011 17:24:47 -0500 Subject: Re: Py-dea: Streamline string literals now! From: Nathan Rice To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325111095 news.xs4all.nl 6931 [2001:888:2000:d::a6]:33594 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18147 On Wed, Dec 28, 2011 at 4:42 PM, Chris Angelico wrote: > On Thu, Dec 29, 2011 at 8:24 AM, Nathan Rice > wrote: >> Quotes are obnoxious in the nesting sense because everyone uses quotes >> for string delimiters. =A0By the same token, quotes are wonderful >> because not only are they intuitive to programmers, but they are >> intuitive in general. =A0Parenthesis are pretty much in the same boat... >> I *HATE* them nested, but they are so intuitive that replacing them is >> a non starter; =A0Just write code that doesn't nest parenthesis. > > Parentheses have different starting and ending delimiters and must be > 'properly nested' (ie there must be exactly-matching inner parens > inside any given set of outer parens (note that English has similar > rules - you can't mis-nest parentheses (at any depth) in either > language)). You can't guarantee the same about quoted strings - > suppose the starting delimiter were ' and the ending " (or vice > versa), it still wouldn't deal with the issue of coming across an > apostrophe inside a quoted string. I think you read more into my statement than was intended. Parens are bad like nested quotes are bad in the sense that they made statements difficult to read and confusing. While it is entirely possible to parse nested strings automatically in a probabilistic manner with nearly flawless accuracy by examining everything between the start and end of the line, generally I feel that people are uncomfortable with probabilistic techniques in the realm of programming :) Best just to make the user be explicit. Nathan