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.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 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> <4efabe1d$0$29966$c3e8da3$5496439d@news.astraweb.com> <4efb9e18$0$29966$c3e8da3$5496439d@news.astraweb.com> 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: 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: 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 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!!