I didn't like my own explanation and did a little more searching.
I just found a better description of this at
http://requires-thinking.blogspot.com/2007/10/note-to-self-default-parameter-values.html.
He points out that the 'def' is an executable statement and it's only
executed once. Therefore, the foo=[] only happens once.
See the Python Language Reference for the authoritative description
http://docs.python.org/ref/function.html
Note the subsection titled "Default parameter values are evaluated
when the function definition is executed."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---