mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() (GH-12139)
Semantically the same, but more idiomatic by checking against `kwargs` instead of `len(kwargs)`.
This commit is contained in:
parent
1c5fa5af8a
commit
76b387bf74
1 changed files with 1 additions and 1 deletions
|
@ -1016,7 +1016,7 @@ class UserDict(_collections_abc.MutableMapping):
|
|||
self.data = {}
|
||||
if dict is not None:
|
||||
self.update(dict)
|
||||
if len(kwargs):
|
||||
if kwargs:
|
||||
self.update(kwargs)
|
||||
def __len__(self): return len(self.data)
|
||||
def __getitem__(self, key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue