Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95188
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'nicely': 0.07; 'val': 0.07; 'cc:addr:python-list': 0.09; 'obj': 0.09; 'def': 0.13; 'interpreter': 0.15; '11:09': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterator': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'this:': 0.23; 'tim': 0.24; 'written': 0.24; 'header :In-Reply-To:1': 0.24; 'sense': 0.26; 'chris': 0.26; 'right.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chase': 0.29; "i'm": 0.30; 'another': 0.32; 'handle': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'something': 0.35; 'step': 0.36; 'depends': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'sure': 0.39; 'chrisa': 0.84; "it'd": 0.84; 'to:none': 0.91; 'subject:membership': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=NAawEZQfkc65BsV3YTRYIlK6S/J0DpNR30SYSLTmJxc=; b=NKsD3XM29RrKtfZSgBKD4jvMDWtAYqzED8cAjDZZVBrzXyRy7WjLCxfYNsV+crBzbH 1qquVqdlmALjDaFMQaxwu3gOTl+ZI7flgB1FiXEexT2NcbNJhXJOiQJleuogBulnveR2 SI963VSh52NIK2l+qqPn2ZjEsUWzyAq3nXbCCNSLf803nXTQg/n5+mI8ohzNi48GNX5N 3lCAk4vM2k3rGfwCkgXbCh6X+YgLcNcFOkjWub33xZ/SX86AX1zckd3RhxcE66bEbx+c Pxlk6aa+iaib3bkhzVrSGtuUASXy7w2/kI/w9kaOGJef6t277NC9eFxJXnKvhcBWC855 ANvA== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.163.11 with SMTP id m11mr16465088ioe.31.1439125880171; Sun, 09 Aug 2015 06:11:20 -0700 (PDT) |
| In-Reply-To | <20150809080917.2c87f22f@bigbox.christie.dr> |
| References | <88256581-75d4-4f77-81f0-9e3e25baecbc@googlegroups.com> <CAPTjJmoibrvoxFt7o3XA+h_5ETTCS1b9uNUOhK=1UpRvo3PTpQ@mail.gmail.com> <20150809080917.2c87f22f@bigbox.christie.dr> |
| Date | Sun, 9 Aug 2015 23:11:20 +1000 |
| Subject | Re: Iterators membership testing |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6.1439125888.3627.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1439125888 news.xs4all.nl 2827 [2001:888:2000:d::a6]:40890 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 3716 |
| X-Received-Body-CRC | 201048748 |
| Xref | csiph.com comp.lang.python:95188 |
Show key headers only | View raw
On Sun, Aug 9, 2015 at 11:09 PM, Tim Chase <tim@thechases.com> wrote: > On 2015-08-09 19:24, Chris Angelico wrote: >> That's exactly right. The only way for the interpreter to handle >> 'in' on an iterator is something like this: >> >> def contains(iter, obj): >> for val in iter: >> if val == obj: return True >> return False > > Which can nicely be written as > > any(i == obj for obj in iter) Indeed it can, although I'm not sure whether it'd just have been another step in the explanation :) Whether or not that makes perfect sense depends on the reader. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Iterators membership testing Pierre Quentel <pierre.quentel@gmail.com> - 2015-08-09 02:06 -0700
Re: Iterators membership testing Chris Angelico <rosuav@gmail.com> - 2015-08-09 19:24 +1000
Re: Iterators membership testing Pierre Quentel <pierre.quentel@gmail.com> - 2015-08-09 02:55 -0700
Re: Iterators membership testing Chris Angelico <rosuav@gmail.com> - 2015-08-09 20:13 +1000
Re: Iterators membership testing Pierre Quentel <pierre.quentel@gmail.com> - 2015-08-09 04:00 -0700
Re: Iterators membership testing Chris Angelico <rosuav@gmail.com> - 2015-08-09 21:10 +1000
Re: Iterators membership testing Laura Creighton <lac@openend.se> - 2015-08-09 13:30 +0200
Re: Iterators membership testing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-09 14:49 +0100
Re: Iterators membership testing Chris Angelico <rosuav@gmail.com> - 2015-08-09 23:11 +1000
Re: Iterators membership testing Tim Chase <python.list@tim.thechases.com> - 2015-08-09 08:09 -0500
Re: Iterators membership testing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-09 14:45 +0100
Re: Iterators membership testing Tim Chase <tim@thechases.com> - 2015-08-09 08:09 -0500
csiph-web