Re: mutable default parameter problem [Prothon]

From: Mark Hahn (mark_at_prothon.org)
Date: 06/28/04


Date: Mon, 28 Jun 2004 10:46:58 -0700
To: python-list@python.org


"Antoon Pardon" <apardon@forel.vub.ac.be> wrote

> Well personnally I would solve this with a more general loop construct.
>
> Something like: (Pseudo code)
>
> loop:
> list.append(x)
> while len(list) < 10:
> blah blah.
>
>
> The more general construct would be something like:
>
> loop:
> code
> while condition1:
> code
> else:
> exit code if condition1 fails
> while condition2:
> code
> else:
> exit code if condion2 fail

This seems non-intuitive to me. Also how would you know the "while" was not
a regular "while"? Even if the parser could figure it out, the reader would
be confused.

BTW: Your code example has the "while" indentation not aligning with
anything above which is illegal indentation.



Relevant Pages