a gap of do....while?
clp2 at rebertia.com
Sun Oct 18 07:34:22 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?
For simplicity of syntax and less duplication among the basic
> 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?
It's essentially the same:
if not cond: break
This is considered idiomatic; and FWIW, I see do-while as having no
significant advantage over this.
More information about the Python-list