Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21624
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'received:209.85.213.174': 0.16; 'received:mail-yx0-f174.google.com': 0.16; 'subject:Poll': 0.16; '\xc2\xa0if': 0.16; 'cc:addr:python-list': 0.16; 'subject:question': 0.16; 'wrote:': 0.18; 'say,': 0.19; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'suspect': 0.24; 'cc:2**0': 0.26; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'skip:\xc2 20': 0.30; 'list': 0.32; 'loop': 0.34; 'list:': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'subject: (': 0.40; 'march': 0.61 |
| 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:to :cc:content-type:content-transfer-encoding; bh=4t6wF/bYKJ2iqWcdZasSA+5n7KGgj3fe82BeE9HoMAM=; b=X86WoFRV4H72fzroNoBz8qnHVvoULuxXgWTR6yOGU8Xzm7Both7HKoap9OsbwLCBBL hnGHTKMpDNDKs/JU8a//j/87ooxKD4AgAIzo4WaTz3hqVi4nrdoYLjfB6wBxV9AuextS TSi3xJXxxtK6Pg8nofRRcEq4dIZ5eZF/skHArIcfdMgJLScdH5dfJd2hJTEspuZXY7ci MZJ6VNwmA5lrH/JFkwB/NV+3MY7pl8aKyt1LH7vEOklNaDKNRWrREFRS3/8zJc5+sp1R LuEqprjpVKxHEeCd1wviQVLsv8tQQaV4H07W/qtrOrgdNb/WGLzT0dRRXV92D9q4sEVV 0mxA== |
| MIME-Version | 1.0 |
| In-Reply-To | <CANm61jcTZNVJAbkj2ZGJ+X1-mUZOoXsR90VstC4rb8UOo1x8Ug@mail.gmail.com> |
| References | <CANm61jcTZNVJAbkj2ZGJ+X1-mUZOoXsR90VstC4rb8UOo1x8Ug@mail.gmail.com> |
| Date | Wed, 14 Mar 2012 20:49:02 +0000 |
| Subject | Re: Style question (Poll) |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Croepha <croepha@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| 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.651.1331758144.3037.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1331758144 news.xs4all.nl 6885 [2001:888:2000:d::a6]:33617 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21624 |
Show key headers only | View raw
On 14 March 2012 20:37, Croepha <croepha@gmail.com> wrote: > Which is preferred: > > for value in list: > if not value is another_value: > value.do_something() > break > > --or-- > > if list and not list[0] is another_value: > list[0].do_something() Hard to say, since they don't do the same thing :) I suspect you meant: for value in list: if not value is another_value: value.do_something() break I always feel uncomfortable with this because it's misleading: a loop that never loops. -- Arnaud
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Style question (Poll) Arnaud Delobelle <arnodel@gmail.com> - 2012-03-14 20:49 +0000
csiph-web