e-mail address change (was Re: [Tutor] python's default argument
value handling in functions - weird syntax? problem grappling
with the concept)
Jeffrey Lim
jfs.world at gmail.com
Wed Feb 9 23:30:59 CET 2005
On Wed, 9 Feb 2005 14:05:23 -0800 (PST), Danny Yoo
<dyoo at hkn.eecs.berkeley.edu> wrote:
>
> [snip]
>
> Does this make sense so far?
YES!!! Most perfectly!!! Thanks for your detailed step-by-step
analysis man - it was very helpful, and much appreciated...
>
> Looking back at the program, I think that you meant to write:
>
> ###
> initialList = []
> def f(a,L=initialList):
> if L==[5]:
> print 'L==[5] caught'
> print L
> print 'resetting L...'
> del L[:] ## Resets the initial value to the empty list
> L.append(a)
> return L
> ###
>
yeah man - i guess i was just still stuck in the "non-object-oriented"
thinking rut... I believe you have just about clarified all the
doubts that i've had about the whole thing which prompted my question
to the list in the first place!
thanks a lot...
-jf
More information about the Tutor
mailing list