[Python-ideas] "While" suggestion
Chris Rebert
cvrebert at gmail.com
Thu Jul 3 22:30:42 CEST 2008
On Thu, Jul 3, 2008 at 1:22 PM, Stavros Korokithakis
<stavros at korokithakis.net> wrote:
> I don't know where this "while True" concept snuck in, the proposal isn't
> supposed to replace those, it's supposed to replace this:
>
> <setup>
> while <expression>"
> <stuff>
> <setup>
And "while True" is the currently accepted idiom to replace that,
which possibly makes "while as" unnecessary.
while True:
<setup>
if not <expression>: break
<stuff>
Note that <setup> is no longer repeated.
- Chris
>
> Stavros
>
> Steven Bethard wrote:
>>
>> On Thu, Jul 3, 2008 at 11:11 AM, Torsten Bronger
>> <bronger at physik.rwth-aachen.de> wrote:
>>>>
>>>> 2008/7/3 Stavros Korokithakis
>>>> <stavros at korokithakis.net>:
>>>>
>>>>> while my_file.read(1024) as data:
>>>>> do_something(data)
>>>
>>> I don't like it. Taken as an English expression, it suggests
>>> something misleading. I looked at my own code (not much; 15.000
>>> lines) and found three "while True", and none of them could be
>>> expressed with "while ... as ...". It is not worth it in my
>>> opinion.
>>
>> I had similar results. Around 10 "while True" constructs, and none of
>> them would have worked with "while ... as ..."
>>
>> -1 for me.
>>
>> Steve
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>
More information about the Python-ideas
mailing list