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


Groups > comp.lang.python > #27603

Re: asking

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'implements': 0.07; 'substring': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; '"b"': 0.16; "he'd": 0.16; 'indent': 0.16; 'opposite': 0.16; 'string:': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'example': 0.23; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'question': 0.27; 'sense': 0.31; 'hopefully': 0.33; 'code:': 0.33; 'false': 0.35; 'but': 0.36; 'cc:no real name:2**1': 0.36; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84; 'have.': 0.95
Date Wed, 22 Aug 2012 01:17:21 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To Ian Foote <ian@feete.org>
Subject Re: asking
References <CADYZVBA9i8Bd87CCPY2N7fz1MqrPB==BXh6GsN44RPHWcEGaug@mail.gmail.com> <5034553F.4080904@feete.org> <50345D6A.1080505@feete.org>
In-Reply-To <50345D6A.1080505@feete.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:RP/zGs+HSWGxhG0eCROLwckkpGa27XUpVYXOImFdOrR C1c7FGGfSJSuqHW+NOSgAAZY/isxmhmz1KwnNy3mUdeqN32uMe AHUeEKXnZoQFCE2/eCHbw0oKHNR6juvu20h2eNdOuFhbbkWfh7 UE0J/OoWZ6ckR/q0NUoGlO6U8ZNhik3yvflIctNmJ/Ix/yWOba ZMSSH4ZzeUYO2Zac4EmEoOatov2kTKsSNxz/b9KzyNOL7tEG3B z/LoH0T6ohIfPj+x+yqB6i7iU/IrsNXFGFiILpQcmSMm8Hwfqw w8rtlResBKvqHob1MYId7CRTvpBwxESHL2F/4HkbBu1faWp8w= =
Cc python-list@python.org, humingqiang5262131@gmail.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
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.3628.1345612667.4697.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345612667 news.xs4all.nl 6859 [2001:888:2000:d::a6]:36390
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27603

Show key headers only | View raw


On 08/22/2012 12:17 AM, Ian Foote wrote:
> Oops, hopefully this with indent correctly:
>
> def all_in(string, substrings):
>     for substring in substrings:
>         if substring not in string:
>             return False
>     return True

The POP's question was ambiguous (did he want to match any of the
substrings, or all of the substrings), but his example code:
   

("a" in "adfbdfc")  or ( "b" in "adfbdfc") or ("c" in "adfbdfc" )

implements the opposite sense of what you have.  So perhaps he'd want:


def any_in(string, substrings):
    for substring in substrings:
        if substring in string:
              return True:
    return False


-- 

DaveA

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


Thread

Re: asking Dave Angel <d@davea.name> - 2012-08-22 01:17 -0400

csiph-web