[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    [Python-ideas] Allow non-callable default_factory for
From:       bmintern () gmail ! com (Brandon Mintern)
Date:       2008-06-03 1:21:54
Message-ID: 4c0fccce0806021821n57ee3044icf57fbe8942ab0eb () mail ! gmail ! com
[Download RAW message or body]

On Mon, Jun 2, 2008 at 8:27 PM, Bruce Leban <bruce at 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic