Please don't top-post, it makes the thread of argument hard to follow.

On Fri, 22 May 2009 01:44:37 +0100, Red Forks <redfo...@gmail.com> wrote:

You mean 'get' method should not alter the dict, does 'dict[key]' should not
alter the dict either?

d = defaultdict(set)
assert len(d) == 0
print d[1]
assert len(d) == 1

auto insert value to dict, when value is not in dict, is what defaultdict
try to do.

Behaviour you are deliberately avoiding by calling `get`, since that
explicitly behaves the same way that it does for dicts.  You're doing
two different things through two different interfaces with two different
specs.  Why are you expecting them to have the same effect?

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to