Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32068 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2012-10-24 15:34 -0600 |
| Last post | 2012-10-24 15:34 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: while expression feature proposal Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-24 15:34 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2012-10-24 15:34 -0600 |
| Subject | Re: while expression feature proposal |
| Message-ID | <mailman.2797.1351114478.27098.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web