Thank you very much for your fast and usefull response, Steven. Have a nice
day.
--
http://mail.python.org/mailman/listinfo/python-list
Whoops, I meant to call
print walk([1,2,3], [])
print walk([4,5,6])
and
print walk([1,2,3])
print walk([4,5,6])
with
def walk(seq, result = []):
for item in seq:
result.append(item)
return result
The question is still the same: Why do both calls give different results?
Thank you very
> print walk([1,2,3])
> print walk([5,6,7])
>
> I get
>
> [1, 2, 3]
> [1, 2, 3, 4, 5, 6]
>
> at stdout, where
>
> def walk(seq, result = []):
> for item in seq:
>result.append(item)
> return result
>
> Does that mean that the scope of optional argum
mean that the scope of optional arguments is global if they aren't
used and local if they are (or am I missing something here)?
Regards,
CS
--
http://mail.python.org/mailman/listinfo/python-list