a gap of do....while?
apt.shansen at gmail.com
Sun Oct 18 07:34:06 CEST 2009
On Sat, Oct 17, 2009 at 10:22 PM, StarWing <weasley_wx at sina.com> wrote:
> okay, I think somethings do....while is useful, but why python didn't
> have it?
> in lisp, we can (while (progn ....))
> and in all other language we have do...while.
> but in python, we only can:
> cond = 1
> while cond:
> cond = 0
> if ....: cond = 1
> has any polite way to handle this?
Although recently there's been a big thread about some people thinking its
bad, the idiomatic way to do it in Python is:
Basically, the answer to "why doesn't Python have a do...while" statement
is-- there's no universally satisfactory way to spell it with Python's
indent-based syntax. Every once in awhile someone proposes a particular way
to do it, but no one has ever really been able to come up with a syntax
See PEP315 (http://www.python.org/dev/peps/pep-0315/) for the deferred
proposal to add such a construct and links to extensive discussions about
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list