]> granicus.if.org Git - python/commit
Add warning that mutable argument defaults are evaluated only once;
authorGuido van Rossum <guido@python.org>
Fri, 7 Aug 1998 17:45:09 +0000 (17:45 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 7 Aug 1998 17:45:09 +0000 (17:45 +0000)
commitaee5e26f4b917d2db2e255a3b86f70d747386763
treecc1b305ac162b2853faff244f550add4677b8d87
parent1a0b87266540c6da06d3dd62248b1a4be660631a
Add warning that mutable argument defaults are evaluated only once;
with examples and workaround.  This keeps coming up, and I believe
that this section in the tutorial may have been (in part) the source
of the confusion.  While it didn't show examples with [] for a default,
it also didn't emphasize enough why that would be a bad idea, and
while it did say that defaults are evaluated at the point of function
definition, the example was not relevant for this issue.
Doc/tut/tut.tex