From 76b387bf7402863c5e64e3459e2f91ddc3b9d2d3 Mon Sep 17 00:00:00 2001 From: Slam <3lnc.slam@gmail.com> Date: Wed, 3 Apr 2019 00:47:41 +0300 Subject: [PATCH] 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)`. --- Lib/collections/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index cff75a48d6..9657c1cf83 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -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): -- 2.49.0