Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'problem:': 0.07; 'string': 0.09; 'delimited': 0.09; 'line:': 0.09; 'lines.': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; '\'"\'),': 0.16; "'\\n')": 0.16; '(it': 0.16; '-tkc': 0.16; 'delimiter': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'pairs': 0.16; 'received:174.136': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'appears': 0.22; 'proposed': 0.22; 'cc:addr:python.org': 0.22; 'text,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'define': 0.26; 'possibly': 0.26; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'tim': 0.29; 'comment': 0.34; 'problem': 0.35; 'something': 0.35; 'false': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'received:10': 0.37; 'quote': 0.39; 'such': 0.63; 'happen': 0.63; 'more': 0.64; 'within': 0.65; 'determine': 0.67 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1416962248048:845261395 X-MC-Ingress-Time: 1416962248048 Date: Tue, 25 Nov 2014 18:40:00 -0600 From: Tim Chase To: Tim Daneliuk Subject: Re: Quotation Ugliness In-Reply-To: References: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416962599 news.xs4all.nl 2868 [2001:888:2000:d::a6]:34185 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81530 On 2014-11-25 18:18, Tim Daneliuk wrote: > A problem for your consideration: > > We are given a tuple of delimiter string pairs to quote or comment > text, possibly over multiple lines. Something like this: > > delims = (('"', '"'), ("'", "'"), ('#', '\n'), ("\*", "*\), > ('\\', '\n') ...) > > These may be nested. > > Here's the problem: Determine is the string S appears *outside* or > *inside* any such quotation. You would have to define what should happen in a case where you have more than one single/double-quote delimited items on the same line: do("this", "and", "that") should it return true or false when testing for 'this", "and", "that'? (it is within double-quotes) And what should happen with mismatched quotes? do("th/*is", "and", "th*/at") It would also help to have a proposed function signature for the functionality you want. Something like def inside_quote(s, corpus, delims=delims): -tkc