Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39657
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '(python': 0.05; 'subject:Question': 0.07; 'collections': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; ':-)': 0.13; 'defaultdict': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; 'import': 0.21; 'work,': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'header:X-Complaints-To:1': 0.28; 'chris': 0.28; 'arguments.': 0.29; 'dictionary': 0.29; 'could': 0.32; 'to:addr :python-list': 0.33; 'skip:d 20': 0.34; 'expected': 0.35; 'received:org': 0.36; 'but': 0.36; 'does': 0.37; 'received:co.za': 0.37; 'received:za': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'choose': 0.65; 'received:41': 0.73; 'frank': 0.75 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Frank Millman <frank@chagford.com> |
| Subject | Re: Question about defaultdict |
| Date | Sat, 23 Feb 2013 12:49:37 +0200 |
| References | <kga4nc$4jm$1@ger.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 41-135-111-29.dsl.mweb.co.za |
| User-Agent | Mozilla/5.0 (Windows NT 5.2; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| In-Reply-To | <kga4nc$4jm$1@ger.gmane.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2336.1361616585.2939.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361616585 news.xs4all.nl 6909 [2001:888:2000:d::a6]:55168 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39657 |
Show key headers only | View raw
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about defaultdict Frank Millman <frank@chagford.com> - 2013-02-23 12:49 +0200
csiph-web