diff -r 149490bbd260 Lib/collections/__init__.py --- a/Lib/collections/__init__.py Sat Nov 01 07:40:22 2014 -0700 +++ b/Lib/collections/__init__.py Wed Nov 05 09:47:12 2014 -0800 @@ -769,20 +769,22 @@ class Counter(dict): def __iand__(self, other): '''Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) ''' + if not hasattr(other, '__getitem__'): + raise TypeError('%r is not subscriptable' % type(other)) for elem, count in self.items(): other_count = other[elem] if other_count < count: self[elem] = other_count return self._keep_positive() ######################################################################## ### ChainMap (helper for configparser and string.Template) ########################################################################