mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Add __bool__ method. Add tests. Fix-up broken test.
This commit is contained in:
parent
cb8b94447c
commit
d032131dcb
2 changed files with 17 additions and 8 deletions
|
@ -679,6 +679,9 @@ class ChainMap(MutableMapping):
|
|||
def __contains__(self, key):
|
||||
return any(key in m for m in self.maps)
|
||||
|
||||
def __bool__(self):
|
||||
return any(self.maps)
|
||||
|
||||
@_recursive_repr()
|
||||
def __repr__(self):
|
||||
return '{0.__class__.__name__}({1})'.format(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue