Concrete Proposal: while ... and while ...
Andrew M. Kuchling
akuchlin at cnri.reston.va.us
Thu May 20 16:58:42 EDT 1999
Paul Prescod writes:
>"Michael P. Reilly" wrote:
>> I'd be interested in knowing how many people would change from the
>> common idioms to this proposed syntax.
I'd love a do... while in Python; its absence is probably my
single biggest problem with Python.
>The current proposal allows me to say what I mean about looping which
>brings Python closer to being executable pseudo-code. do/while would be
>even better but may not be worth the code breakage (though I am curious
>how much code breakage there would really be).
I don't see why do...while would break code. It would
probably look like this:
do:
L = f.readline()
while regexpattern.match(L) is None
'while' without a colon is a syntax error, unless preceded by a 'do'.
'while' with a colon is the same as it is now. I don't see how
'do'...'while' would be difficult to implement (though I admittedly
haven't tried to implement it). 'while' with a colon and subsequent
statement block would also be acceptable.
--
A.M. Kuchling http://starship.python.net/crew/amk/
The Law, in its majestic equality, forbids the rich, as well as the poor, to
sleep under the bridges, to beg in the streets, and to steal bread.
-- Anatole France
More information about the Python-list
mailing list