List and Dicts as default args
Edward C. Jones
edcjones at erols.com
Mon Apr 3 14:04:43 EDT 2000
Fredrik Lundh wrote:
> Stefan Migowsky <smigowsky at dspace.de> wrote:
> > I was just wondering how to handle lists and dictionaries in
> > a simple way as default arguments to functions. Since following
> > strange behaviour occured :
>
> when exposed to "strange" behaviour, please check the FAQ
> http://www.python.org/doc/FAQ.html#6.25
>
> or the fine manual
> http://www.python.org/doc/current/ref/function.html
>
> before posting.
Migowsky asked an advanced newbie question. People who are
inexperienced with a language have not learned enough facts yet to
easily use the documentation (even good documentation, like
Python's). When I have questions like this, I try to guess the "magic
words" (here "default arguments") Then I run a big grep
grep 'default argument' /usr/doc/python-docs-1.5.2p2/*/*.html
A good context for this is provided by "Words and Rules: The
Ingredients of Language" by Stephen Pinker (Basic Books, 1999).
More information about the Python-list
mailing list