Permalink
Browse files

update

  • Loading branch information...
proycon committed Apr 5, 2013
1 parent 36e5abf commit d2c1d66feccb8dd29deb56c6b663b89818d3dd51
Showing with 4 additions and 1 deletion.
  1. +4 −1 statistics.py
View
@@ -118,7 +118,10 @@ def items(self):
def __getitem__(self, type):
if self.dovalidation: type = self._validate(type)
- return self._count[type]
+ try:
+ return self._count[type]
+ except KeyError:
+ return 0
def __setitem__(self, type, value):
"""alias for count, but can only be called once"""

0 comments on commit d2c1d66

Please sign in to comment.