[Python-Dev] Proposal: defaultdict
Alex Martelli
aleaxit at gmail.com
Mon Feb 20 22:24:24 CET 2006
More information about the Python-Dev mailing list
Mon Feb 20 22:24:24 CET 2006
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 20, 2006, at 12:38 PM, Aahz wrote:
...
>> Can you say, for the record (since nobody else seems to care), if
>> d.getorset(key, func) would work in your use cases?
>
> Because I haven't been reading this thread all that closely, you'll
> have
> to remind me what this means.
Roughly the same (save for method/function difference) as:
def getorset(d, key, func):
if key not in d: d[key] = func()
return d[key]
Alex
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list