list as paremeters...

Michael Peuser mpeuser at web.de
Sun Aug 31 13:11:32 EDT 2003


"Mel Wilson" <mwilson at the-wire.com> schrieb im Newsbeitrag
news:obgU/ks/KbsM089yn at the-wire.com...
> In article <bislss$ckt13$1 at ID-67890.news.uni-berlin.de>,
> "Ulrich Petri" <ulope at gmx.de> wrote:
> >IIRC Default values are not created each time the function called but
rather
> >only the first time (am i correct here?). And since a list is mutable it
> >"rememberes" the previous value.
>
>    Default values are created when the 'def' statement is
> executed,

This seems to be generally a somewhat underestimated issue...

See this example:
while c:
       b=Button(...)
       b.config(command=lambda x=b: doSomething(x))

This would not work otherwise...


Kindly
Michael P






More information about the Python-list mailing list