Getting around immutable default arguments for recursion
Ben Finney
bignose+hates-spam at benfinney.id.au
Wed Jan 14 17:38:58 EST 2009
dpapathanasiou <denis.papathanasiou at gmail.com> 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
here.
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