Permalink
Browse files

MB-6867: Save generated value for defaultdict

Instead of just returning value, keep it in dict.

Change-Id: I2a9862503b71f2234a4a450c48998b5f53a951bc
Reviewed-on: http://review.couchbase.org/21602
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
  • Loading branch information...
1 parent bcbe7d3 commit a36fe5002bbf5dfcf27a3251cfed85c341e2156d @bcui6611 bcui6611 committed with Peter Wansch Oct 12, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 cbcollections.py
View
@@ -14,4 +14,5 @@ def __getitem__(self, key):
try:
return super(defaultdict, self).__getitem__(key)
except KeyError:
- return self.default_factory()
+ self[key] = self.default_factory()
+ return self[key]

0 comments on commit a36fe50

Please sign in to comment.