Re:Python's Mutable Default Problem
by pedro3005 on Sunday February 20, 2011 @01:13PM
(#2242558)
You can use this trick for memoization.
Example: http://paste.pocoo.org/show/341849/
[ Parent
| on HN ]
The article is right, though, in stating that later viewers of your code may not be expecting this behavior, and it culd lead to problems.
Re:Python's Mutable Default Problem
by underwater on Sunday February 20, 2011 @09:18PM
(#2243969)
Memorization is an implementation detail and shouldn't be part of the arguments list.