Getting around immutable default arguments for recursion

James Mills prologic at shortcircuit.net.au
Wed Jan 14 18:37:14 EST 2009


On Thu, Jan 15, 2009 at 9:27 AM, dpapathanasiou
<denis.papathanasiou at gmail.com> wrote:
> Without the "if priors:" line just above the first return statement (a
> typo perhaps?), then yes, it would do what I want.

Yes sorry it was :)

>> a) a global should and need not be used.
>
> Passing the entire dictionary to every function that accesses it is
> better?

Yes :)

>> b) this function could be rewritten without recursion.
>
> Right, any recursive function can be written iteratively and vice-
> versa. I'm not sure that makes it "bad".

No it doesn't necessarily make it bad,
but recursion is not necessary here :)

What does history_db look like ? I think
I can write a much simpler function for you.

Also, show me what the results are used for.

cheers
James



More information about the Python-list mailing list