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


Groups > comp.lang.python > #18193

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 <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'skip:# 20': 0.03; 'attributes': 0.05; 'parser': 0.05; 'delimiter': 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; 'delimited': 0.16; 'delimiters': 0.16; 'double-quote': 0.16; 'later).': 0.16; 'parser,': 0.16; 'wed,': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'literal': 0.23; 'string': 0.24; 'besides': 0.24; 'skip:_ 20': 0.26; "i'm": 0.26; 'problem': 0.29; 'pm,': 0.29; 'closing': 0.30; 'whitespace': 0.30; 'propose': 0.32; 'idea': 0.32; 'comment': 0.32; 'people,': 0.32; "isn't": 0.33; 'header :User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'to:addr :python-list': 0.34; 'too': 0.34; 'anything': 0.34; '(not': 0.35; 'received:au': 0.36; 'two': 0.37; 'skip:_ 10': 0.37; 'using': 0.38; 'steven': 0.38; 'received:org': 0.38; 'easier': 0.38; 'characters': 0.39; 'should': 0.39; 'being': 0.39; 'johnson': 0.39; 'why': 0.39; "it's": 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'your': 0.61; 'back': 0.62; 'stop': 0.63; 'comments,': 0.64; 'further': 0.64; 'subject:!': 0.67; 'person.': 0.70; '12:44': 0.84; 'marker': 0.84; 'sommers': 0.84; 'received:110': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lie Ryan <lie.1296@gmail.com>
Subject Re: Py-dea: Streamline string literals now!
Date Fri, 30 Dec 2011 10:19:10 +1100
References <280841b8-8674-4c1d-9a82-28982340a4b8@v24g2000yqk.googlegroups.com> <b2ced8f0-81af-44be-9cea-b6257c84d284@p13g2000yqd.googlegroups.com> <4efabe1d$0$29966$c3e8da3$5496439d@news.astraweb.com> <c233420e-81e8-49be-baa2-12f71f5fc09e@n39g2000yqh.googlegroups.com> <4efb9e18$0$29966$c3e8da3$5496439d@news.astraweb.com> <pan.2011.12.29.01.43.57@tombstonezero.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
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 <pan.2011.12.29.01.43.57@tombstonezero.net>
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.4234.1325200768.27778.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325200768 news.xs4all.nl 6952 [2001:888:2000:d::a6]:35359
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18193

Show key headers only | View raw


On 12/29/2011 12:44 PM, Dan Sommers wrote:
> On Wed, 28 Dec 2011 22:54:16 +0000, Steven D'Aprano wrote:
>
>> On Wed, 28 Dec 2011 11:36:17 -0800, Rick Johnson wrote:
>>
>>> The point is people, we should be using string delimiters that are
>>> ANYTHING besides " and '. Stop being a sheep and use your brain!
>>
>> "ANYTHING", hey?
>>
>> I propose we use ئ and ร as the opening and closing string delimiters.
>> Problem solved!
>
> Why stop at pre-determined, literal delimiters?  That's way too easy on
> the parser, whether that parser is a computer or a person.
>
> __string_delimiter__ = Ω  # magic syntax; no quotes needed
>
> x = ΩhelloΩ
>
> __string_delimiter__ = #  # that first # isn't a comment marker
>
> x = # this isn't a comment; it's part of the string
> this is a multi-line string
> #
>
> __string_delimiter__ = ''  # the delimiter is delimited by whitespace
> # now I can have comments, again, too
>
> x = ''"hello"''  # now x contains two double-quote characters
>
> I'm sure that the implementation is trivial, and it's so much easier to
> write strings that contain quotes (not to mention how easy it is to read
> those strings back later).

right and you can generalize this idea even further

__comment_marker__ = $
__string_delimiter__ = [#, %]
$ also, even further
__comment_marker_keyword = #__my_own_comment_marker__%
__my_own_comment_marker__ = [&, *]
__assignment_symbol__ = <-
__attribute_delimiter__ <- -> & for attributes *
__call_delimiter__ = [!,@]
l = []
l->append!5@

you're a genius!!

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