Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.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.002 X-Spam-Evidence: '*H*': 1.00; '*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; 'received:209.85.214.174': 0.13; '(note': 0.16; 'apostrophe': 0.16; 'delimiters': 0.16; 'formats,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'general.': 0.16; 'nest': 0.16; 'nesting': 0.16; 'parentheses': 0.16; "wouldn't": 0.17; 'wrote:': 0.18; 'dec': 0.22; '(or': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'replacing': 0.23; 'string': 0.24; 'code': 0.25; 'message- id:@mail.gmail.com': 0.28; 'problem': 0.29; 'outer': 0.30; 'source': 0.31; 'thu,': 0.32; 'actual': 0.32; 'received:209.85.214': 0.32; 'pretty': 0.32; "can't": 0.32; 'rather': 0.33; 'there': 0.33; 'rules': 0.34; 'to:addr:python- list': 0.34; 'anything': 0.34; 'matter,': 0.34; 'issue': 0.35; 'vice': 0.35; 'similar': 0.36; 'starting': 0.36; 'uses': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'non': 0.38; 'either': 0.39; 'everyone': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'guarantee': 0.65; 'subject:!': 0.67; 'intuitive': 0.67; '29,': 0.73; 'nathan': 0.84; 'interchange': 0.91; 'poorly': 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=4FSFZamqbOEIhuz9SLjlXd+k6EZpaZABIoJz6zHeN6s=; b=iDG0ICoeZNorryQDMSBj0Z+F5khAZI90kB30H2L+zqWaZvDmhgxajrqBAVZjG+9DF0 YjakrEGHU+EAwmQEOFEMjBDIN0VADiHV8IGwf0eBUWvghziqFPO/TzpgDcJJ4yTrv1Uv wqe3tQyQEtxTBJVXNBoUVSuCJg56SVvWowim8= MIME-Version: 1.0 In-Reply-To: References: <280841b8-8674-4c1d-9a82-28982340a4b8@v24g2000yqk.googlegroups.com> <1325106214.5274.140661016836917@webmail.messagingengine.com> Date: Thu, 29 Dec 2011 08:42:46 +1100 Subject: Re: Py-dea: Streamline string literals now! From: Chris Angelico 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325108570 news.xs4all.nl 6946 [2001:888:2000:d::a6]:33009 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18146 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. In actual fact, the real problem is that quoted strings need to be able to contain _anything_. The only true solution to that is length-provided strings: s =3D "4spam q =3D "14Hello, world!\n This works beautifully in interchange formats, but rather poorly in source code (or, for that matter, anything editable). ChrisA