Monday, October 16, 2006
do-while loops in Python
f = open ( filename ) do buf = f.read(blocksize) do_something_with_buf(buf) while buf
Apparently, there is PEP (Python Enhancement Proposal) 315 pending since 2003 that would request just that, a "do-while" loop implementation. This was considered at some point as a possible candidate for Python 2.5, but was rejected as not that important, and this comment and recent discussion at python-dev mailing list revealed lack of consensus on simple, implementable, Python-style syntax for "do-while" loops.
It seems like therefore this will have to wait (at best) till "Python 3000" version of Python (a.k.a. "Py3k" or sometimes even "p3yk"), which is kind of sad.
BTW, this presentation has a nice overview of Py3k plans and ideas.