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


Groups > comp.lang.python > #81536

Re: Quotation Ugliness

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <tundra@tundraware.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'problem:': 0.07; 'remaining': 0.07; 'string': 0.09; 'delimited': 0.09; 'false.': 0.09; 'line:': 0.09; 'lines.': 0.09; 'pgp': 0.09; 'cc:addr:python- list': 0.11; 'def': 0.12; '\'"\'),': 0.16; "'\\n')": 0.16; '(it': 0.16; 'delimiter': 0.16; 'pairs': 0.16; 'quoted': 0.16; 'to:addr:python.list': 0.16; 'to:addr:tim.thechases.com': 0.16; 'to:name:tim chase': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'appears': 0.22; 'proposed': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; '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; 'thus': 0.29; 'tim': 0.29; 'chase': 0.31; 'run': 0.32; 'comment': 0.34; "i'd": 0.34; 'problem': 0.35; 'something': 0.35; 'false': 0.36; 'should': 0.36; 'pm,': 0.38; 'quote': 0.39; 'such': 0.63; 'happen': 0.63; 'more': 0.64; 'charset:windows-1252': 0.65; 'within': 0.65; 'determine': 0.67
Date Tue, 25 Nov 2014 19:18:52 -0600
From Tim Daneliuk <tundra@tundraware.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version 1.0
Newsgroups comp.lang.python
To Tim Chase <python.list@tim.thechases.com>
Subject Re: Quotation Ugliness
References <grifkb-kpo1.ln1@ozzie.tundraware.com> <mailman.16297.1416962599.18130.python-list@python.org>
In-Reply-To <mailman.16297.1416962599.18130.python-list@python.org>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Greylist Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (ozzie.tundraware.com [75.145.138.73]); Tue, 25 Nov 2014 19:18:52 -0600 (CST)
X-TundraWare-MailScanner-Information Please contact the ISP for more information
X-TundraWare-MailScanner-ID sAQ1IqLW051315
X-TundraWare-MailScanner Found to be clean
X-TundraWare-MailScanner-From tundra@tundraware.com
X-Spam-Status No
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.16301.1416964940.18130.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416964940 news.xs4all.nl 2874 [2001:888:2000:d::a6]:52394
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81536

Show key headers only | View raw


On 11/25/2014 06:40 PM, Tim Chase wrote:
> 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")

Each of them is considered quoted and thus if S appears within
any of them it is "inside".

>
> should it return true or false when testing for 'this", "and",
> "that'?  (it is within double-quotes)

False.

>
> And what should happen with mismatched quotes?
>
>    do("th/*is", "and", "th*/at")

Match pairs as usual, and let the remaining unterminated quote run on.

>
> It would also help to have a proposed function signature for the
> functionality you want.  Something like
>
>    def inside_quote(s, corpus, delims=delims):


I'd prefer:

    def quoted (s, corpus, delims=delims, domain=outside)
----------------------------------------------------------------------------
Tim Daneliuk     tundra@tundraware.com
PGP Key:         http://www.tundraware.com/PGP/

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


Thread

Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 18:18 -0600
  Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-25 18:40 -0600
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:18 -0600
      Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 12:32 +1100
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:00 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:00 -0600
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:18 -0600
  Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 11:44 +1100
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:20 -0600
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:20 -0600
      Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-25 19:44 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:01 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:01 -0600
  Re: Quotation Ugliness Ben Finney <ben+python@benfinney.id.au> - 2014-11-26 12:54 +1100
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:04 -0600
    Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:04 -0600
      Using a password with ‘sudo’ (was: Quotation Ugliness) Ben Finney <ben+python@benfinney.id.au> - 2014-11-26 18:02 +1100
      Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 18:10 +1100
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:59 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:59 -0600
      Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 06:56 -0600
        Re: Quotation Ugliness Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-11-26 15:45 +0200
          Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 01:37 +1100
          Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 08:26 -0600
          Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:07 +1100
          Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:09 +1100
            Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:36 -0600
            Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:36 -0600
              Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:48 +1100
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:55 -0600
                Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 11:00 -0500
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:02 -0600
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:02 -0600
                Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 03:13 +1100
                Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 11:16 -0500
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
                Re: Quotation Ugliness alister <alister.nospam.ware@ntlworld.com> - 2014-11-26 16:45 +0000
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
                Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:55 -0600
              Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 10:53 -0500
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:58 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:58 -0600
          Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:06 +1100
          Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 09:23 -0600
          Re: Quotation Ugliness Ben Finney <ben+python@benfinney.id.au> - 2014-11-27 07:24 +1100
      Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 09:12 -0500
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:02 -0600
        Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:02 -0600
          Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 10:16 -0500

csiph-web