Help - strange behaviour from python list
Fredrik Lundh
fredrik at pythonware.com
Tue Apr 11 08:35:31 EDT 2006
Sean Hammond wrote:
> I've managed to create a scenario in which editing an object in a list of
> objects seems to edit every object in the list, rather than just the one.
> I'm totally stumped and wondered if anyone would be kind enough to read my
> explanation and see if they have any suggestions. I have probably stumbled
> into some typical newbie problem, but anyway:
some useful resources:
http://docs.python.org/tut/node6.html#SECTION006710000000000000000
(see the paragraph that starts with "important warning")
http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects
http://docs.python.org/ref/function.html
(see the paragraph that starts with "Default parameters are evaluated when the
function definition is executed")
(you cannot say we didn't warn you ;-)
</F>
More information about the Python-list
mailing list