2 Jun
2008
2 Jun
'08
8:21 p.m.
On Mon, Jun 2, 2008 at 8:27 PM, Bruce Leban <bruce@leapyear.org> wrote:
I don't see an extra lambda as that complicated. What is more complicated is that when I see the code:
d = defaultdict(foo)
I (the reader of the code) can't tell whether foo is the default value or the default function. So I better always write (lambda: foo) unless foo is a constant. Doesn't to have enough benefit to change.
--- Bruce
Ahh.... that makes a lot of sense. I hadn't considered it from that angle. Thanks for the good explanation, Brandon