> Are we talking about the same setdefault()?
>
>
>     D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
>
> There is no per-instance default value just on per call:

Oh. You're right. I was somehow under the impression that setdefault is
per-instance, so that I can avoid

d.get(key, default)

and write

d[key]

instead, for all keys, and get no more KeyErrors. But then you are
right of course.

Regards,

Diez

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to