mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
SF #904720: dict.update should take a 2-tuple sequence like dict.__init_
(Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments.
This commit is contained in:
parent
6c79a518e7
commit
31017aed36
11 changed files with 92 additions and 56 deletions
|
@ -433,9 +433,6 @@ else:
|
|||
return key.upper() in self.data
|
||||
def get(self, key, failobj=None):
|
||||
return self.data.get(key.upper(), failobj)
|
||||
def update(self, dict):
|
||||
for k, v in dict.items():
|
||||
self[k] = v
|
||||
def copy(self):
|
||||
return dict(self)
|
||||
|
||||
|
@ -447,9 +444,6 @@ else:
|
|||
def __setitem__(self, key, item):
|
||||
putenv(key, item)
|
||||
self.data[key] = item
|
||||
def update(self, dict):
|
||||
for k, v in dict.items():
|
||||
self[k] = v
|
||||
try:
|
||||
unsetenv
|
||||
except NameError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue