Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32068
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.033 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; 'subject:while': 0.09; '24,': 0.16; 'assignment.': 0.16; 'expr': 0.16; 'oct': 0.16; 'subject:expression': 0.16; 'true:': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'duplicate': 0.17; 'variable': 0.20; 'bit': 0.21; 'header :In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'dan': 0.29; "i'm": 0.29; 'received:209.85.215.46': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'due': 0.66; 'felt': 0.75; 'idiomatic': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=lPvr2S+oEvEGjWZ4iBrJmxqnhAr57UeBYD1Dm689ob0=; b=F9kOha6J2Clhk4I24kbXqPvcgjZ0jBPhDnnWJ51Jm3F70pDk8b9U24W1XqV2e1BK5s rY1wN1RM08wR5TlFCSqb5jPlzlegP3Y623WdlB+/NGMGJH04yRcLP2/58bFlGEV332Y0 2Da8ohBqH8cDUBv6nUFQgbMtL0sQUB3lxpSTx1d0IM5lZMkL4lBMFBVLNqxHHijhNgRw r8u9LK8glbJdCE6IlLQD3g1TFRnxK04yYeOferTwNJQZqeRIBz2wpQZFhIlpLp+JFB3f yb33b5lXsaQPKwvxPMDg1APq0BopZ0qOzPtz9KSwZiNFrfCZdSYPRkzeCI+5U59dvFEY wBXg== |
| MIME-Version | 1.0 |
| In-Reply-To | <CAOKWLrERVuT-u=9YZGnQUhWLv2M6F06pU20vG9W1joD9h-SdSQ@mail.gmail.com> |
| References | <CAOKWLrERVuT-u=9YZGnQUhWLv2M6F06pU20vG9W1joD9h-SdSQ@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 24 Oct 2012 15:34:05 -0600 |
| Subject | Re: while expression feature proposal |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <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.2797.1351114478.27098.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351114478 news.xs4all.nl 6877 [2001:888:2000:d::a6]:49865 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32068 |
Show key headers only | View raw
On Wed, Oct 24, 2012 at 2:40 PM, Dan Loewenherz <dloewenherz@gmail.com> wrote:
> So I'm sure a lot of you have run into the following pattern. I use it
> all the time and it always has felt a bit awkward due to the duplicate
> variable assignment.
>
> VAR = EXPR
> while VAR:
> BLOCK
> VAR = EXPR
The idiomatic way to do this is:
while True:
VAR = EXPR
if not VAR:
break
BLOCK
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: while expression feature proposal Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-24 15:34 -0600
csiph-web