Nelson Crosby wrote:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I've always hated code that looks like this. Partly due to the repetition,
but partly also due to the fact that without being
On 12/12/2014 02:21, Nelson Crosby wrote:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I've always hated code that looks like this. Partly due to the repetition, but
partly also due to the fact that
On Fri, Dec 12, 2014 at 7:00 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
It won't happen as different format loops have been discussed and rejected
umpteen times over the last 20 odd years, mainly because the code can be
restructured using break as others have already pointed out. Unless
Chris Angelico ros...@gmail.com:
On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Chris Angelico ros...@gmail.com:
You could deduplicate it by shifting the condition:
while True:
value = get_some_value()
if value not in undesired_values: break
But I'm not
Marko Rauhamaa ma...@pacujo.net wrote:
Chris Angelico ros...@gmail.com:
You could deduplicate it by shifting the condition:
while True:
value = get_some_value()
if value not in undesired_values: break
But I'm not sure how common this idiom actually is.
Extremely common,
c...@isbd.net:
Marko Rauhamaa ma...@pacujo.net wrote:
Chris Angelico ros...@gmail.com:
You could deduplicate it by shifting the condition:
while True:
value = get_some_value()
if value not in undesired_values: break
But I'm not sure how common this idiom actually is.
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I've always hated code that looks like this. Partly due to the repetition, but
partly also due to the fact that without being able to immediately recognise
Nelson Crosby n...@sourcecomb.com writes:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I think that's an anti-pattern (because of the repetition, as you say).
An improvement::
value =
On Fri, Dec 12, 2014 at 1:21 PM, Nelson Crosby n...@sourcecomb.com wrote:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I've always hated code that looks like this. Partly due to the repetition,
but
: Thursday, December 11, 2014 6:38 PM
To: python-list@python.org
Subject: Re: Extension of while syntax
Nelson Crosby n...@sourcecomb.com writes:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
I think
On 12/11/2014 9:21 PM, Nelson Crosby wrote:
I was thinking a bit about the following pattern:
value = get_some_value()
while value in undesired_values:
value = get_some_value()
This is do_while or do_until. In Python, write it as do_until in this form.
while True:
value =
(Please don't top-post; instead, interleave responses inline with the
quoted material and trim the excess. See
URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style.)
Clayton Kirkwood c...@godblessthe.us writes:
I would prefer:
while value = initial_value in undesired_values:
Chris Angelico ros...@gmail.com:
You could deduplicate it by shifting the condition:
while True:
value = get_some_value()
if value not in undesired_values: break
But I'm not sure how common this idiom actually is.
Extremely common, and not only in Python.
Marko
--
On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Chris Angelico ros...@gmail.com:
You could deduplicate it by shifting the condition:
while True:
value = get_some_value()
if value not in undesired_values: break
But I'm not sure how common this idiom actually
14 matches
Mail list logo