Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39657 > unrolled thread

Re: Question about defaultdict

Started byFrank Millman <frank@chagford.com>
First post2013-02-23 12:49 +0200
Last post2013-02-23 12:49 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question about defaultdict Frank Millman <frank@chagford.com> - 2013-02-23 12:49 +0200

#39657 — Re: Question about defaultdict

FromFrank Millman <frank@chagford.com>
Date2013-02-23 12:49 +0200
SubjectRe: Question about defaultdict
Message-ID<mailman.2336.1361616585.2939.python-list@python.org>
On 23/02/2013 12:13, Frank Millman wrote:
> Hi all
>
> I use a dictionary as a cache, and I thought that I could replace it
> with collections.defaultdict, but it does not work the way I expected
> (python 3.3.0).
 >
[...]
>
> from collections import defaultdict
> my_cache = defaultdict(fetch_object)
> my_obj = my_cache['a']
>
> It does not work, because fetch_object() is called without any arguments.

Thanks, Chris and Peter. Some nice ideas to choose from :-)

Frank


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web