mutable default parameter problem [Prothon]

Mark Hahn mark at prothon.org
Mon Jun 28 19:46:58 CEST 2004


"Antoon Pardon" <apardon at 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.







More information about the Python-list mailing list