On Thu, 21 May 2009 13:07:50 +0100, Red Forks <redfo...@gmail.com> wrote:
from collections import defaultdict d = defaultdict(set) assert isinstance(d['a'], set) assert isinstance(d.get('b'), set) d['a'] is ok, and a new set object is insert to d, but d.get('b') won't. It's a bug, or just a feature?
Feature. You're blaming 'get' for doing exactly what it said it would, both in returning None and not gratuitously altering the dictionary. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list