Getting around immutable default arguments for recursion

Ben Finney bignose+hates-spam at
Wed Jan 14 23:38:58 CET 2009

dpapathanasiou <denis.papathanasiou at> writes:

> But every subsequent call returned the results of the prior call,
> plus the results of the current call.
> I was confused until I read in the docs that default arguments are
> immutable.

You'll continue to be confused if you use that term. Python already
has a specific use of the term “immutable”, and it doesn't apply

Better to say: default arguments are part of the function definition
statement, and are evaluated when the definition is evaluated.

 \        “To me, boxing is like a ballet, except there's no music, no |
  `\       choreography, and the dancers hit each other.” —Jack Handey |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list