Re: [Tutor] newbie question about default arguments

2006-03-29 Thread Josh Adams
Thanks for your help. That makes a lot more sense. Not to ask too many stupid questions, but why does the L2 assignment in the if-block create a new L variable? Shouldn't the scope from the function definition dominate the inner scope of the if-block? Thanks, Josh > Josh, > > If you print t

[Tutor] newbie question about default arguments

2006-03-29 Thread Josh Adams
Hi all, I was going through the tutorial at http://docs.python.org/tut/node6.html when I came to the bit about default arguments with this code: def f(a, L=[]): L.append(a) return L print f(1) print f(2) print f(3) returns: [1] [1, 2] [1, 2, 3] >From the postings here, I think I underst