mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Add tests for the collections helper class and sync-up with py3k branch.
This commit is contained in:
parent
48e5cd3df3
commit
dcb29c93d2
2 changed files with 121 additions and 2 deletions
|
@ -694,6 +694,15 @@ class _ChainMap(MutableMapping):
|
|||
|
||||
__copy__ = copy
|
||||
|
||||
def new_child(self): # like Django's Context.push()
|
||||
'New ChainMap with a new dict followed by all previous maps.'
|
||||
return self.__class__({}, *self.maps)
|
||||
|
||||
@property
|
||||
def parents(self): # like Django's Context.pop()
|
||||
'New ChainMap from maps[1:].'
|
||||
return self.__class__(*self.maps[1:])
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.maps[0][key] = value
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue