List and Dicts as default args

Edward C. Jones edcjones at
Mon Apr 3 20:04:43 CEST 2000

Fredrik Lundh wrote:

> Stefan Migowsky <smigowsky at> 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
> or the fine manual
> 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