Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18146
| 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> |
|---|---|
| Date | 2011-12-29 08:42 +1100 |
| Subject | Re: Py-dea: Streamline string literals now! |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4199.1325108570.27778.python-list@python.org> (permalink) |
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. 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 = "4spam q = "14Hello, world!\n This works beautifully in interchange formats, but rather poorly in source code (or, for that matter, anything editable). ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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