Kaydet (Commit) 76b387bf authored tarafından Slam's avatar Slam Kaydeden (comit) Miss Islington (bot)

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)`.
üst 1c5fa5af
...@@ -1016,7 +1016,7 @@ class UserDict(_collections_abc.MutableMapping): ...@@ -1016,7 +1016,7 @@ class UserDict(_collections_abc.MutableMapping):
self.data = {} self.data = {}
if dict is not None: if dict is not None:
self.update(dict) self.update(dict)
if len(kwargs): if kwargs:
self.update(kwargs) self.update(kwargs)
def __len__(self): return len(self.data) def __len__(self): return len(self.data)
def __getitem__(self, key): def __getitem__(self, key):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment