Skip to content

Commit 76b387b

Browse files
0bsearchmiss-islington
authored andcommitted
Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() (pythonGH-12139)
Semantically the same, but more idiomatic by checking against `kwargs` instead of `len(kwargs)`.
1 parent 1c5fa5a commit 76b387b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/collections/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ def __init__(*args, **kwargs):
10161016
self.data = {}
10171017
if dict is not None:
10181018
self.update(dict)
1019-
if len(kwargs):
1019+
if kwargs:
10201020
self.update(kwargs)
10211021
def __len__(self): return len(self.data)
10221022
def __getitem__(self, key):

0 commit comments

Comments
 (0)