Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18147

Re: Py-dea: Streamline string literals now!

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 <nathan.alexander.rice@gmail.com>
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 <CAPTjJmrXSd8DGP+JrSK6-+NjrrKsEAswk6Vv+xHFLeZPy3OfzA@mail.gmail.com>
References <280841b8-8674-4c1d-9a82-28982340a4b8@v24g2000yqk.googlegroups.com> <b2ced8f0-81af-44be-9cea-b6257c84d284@p13g2000yqd.googlegroups.com> <jdfvkl$at6$1@dough.gmane.org> <1325106214.5274.140661016836917@webmail.messagingengine.com> <CAOFbRmJOXHfv-tpUvaoEWWjmf9NNRVZi2JG0Zs4zion4hwu3Ow@mail.gmail.com> <CAPTjJmrXSd8DGP+JrSK6-+NjrrKsEAswk6Vv+xHFLeZPy3OfzA@mail.gmail.com>
Date Wed, 28 Dec 2011 17:24:47 -0500
Subject Re: Py-dea: Streamline string literals now!
From Nathan Rice <nathan.alexander.rice@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4200.1325111095.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Wed, Dec 28, 2011 at 4:42 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Thu, Dec 29, 2011 at 8:24 AM, Nathan Rice
> <nathan.alexander.rice@gmail.com> wrote:
>> Quotes are obnoxious in the nesting sense because everyone uses quotes
>> for string delimiters.  By the same token, quotes are wonderful
>> because not only are they intuitive to programmers, but they are
>> intuitive in general.  Parenthesis are pretty much in the same boat...
>> I *HATE* them nested, but they are so intuitive that replacing them is
>> a non starter;  Just 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Py-dea: Streamline string literals now! Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-27 19:49 -0800
  Re: Py-dea: Streamline string literals now! Chris Angelico <rosuav@gmail.com> - 2011-12-28 15:17 +1100
    Re: Py-dea: Streamline string literals now! Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-27 20:36 -0800
  Re: Py-dea: Streamline string literals now! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-28 04:20 +0000
  Re: Py-dea: Streamline string literals now! Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-27 21:34 -0800
    Re: Py-dea: Streamline string literals now! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-28 06:58 +0000
      Re: Py-dea: Streamline string literals now! Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-28 11:36 -0800
        Re: Py-dea: Streamline string literals now! Dominic Binks <dbinks@codeaurora.org> - 2011-12-28 12:10 -0800
        Re: Py-dea: Streamline string literals now! Lie Ryan <lie.1296@gmail.com> - 2011-12-29 07:13 +1100
        Re: Py-dea: Streamline string literals now! Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-28 13:52 -0700
        Re: Py-dea: Streamline string literals now! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-28 22:54 +0000
          Re: Py-dea: Streamline string literals now! Chris Angelico <rosuav@gmail.com> - 2011-12-29 10:08 +1100
          Re: Py-dea: Streamline string literals now! Dan Sommers <dan@tombstonezero.net> - 2011-12-29 01:44 +0000
          Re: Py-dea: Streamline string literals now! Lie Ryan <lie.1296@gmail.com> - 2011-12-30 10:19 +1100
          Re: Py-dea: Streamline string literals now! Chris Angelico <rosuav@gmail.com> - 2011-12-30 10:24 +1100
    Re: Py-dea: Streamline string literals now! Chris Angelico <rosuav@gmail.com> - 2011-12-28 18:47 +1100
    Re: Py-dea: Streamline string literals now! Lie Ryan <lie.1296@gmail.com> - 2011-12-29 07:53 +1100
    Re: Py-dea: Streamline string literals now! python@bdurham.com - 2011-12-28 16:03 -0500
    Re: Py-dea: Streamline string literals now! Nathan Rice <nathan.alexander.rice@gmail.com> - 2011-12-28 16:24 -0500
    Re: Py-dea: Streamline string literals now! Chris Angelico <rosuav@gmail.com> - 2011-12-29 08:42 +1100
    Re: Py-dea: Streamline string literals now! Nathan Rice <nathan.alexander.rice@gmail.com> - 2011-12-28 17:24 -0500
    Re: Py-dea: Streamline string literals now! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-12-29 00:00 -0500

csiph-web