Skip to content

Commit 2255af3

Browse files
rhettingerpicnixz
andauthored
Update Lib/collections/__init__.py
Algebraic simplification saving a local variable store and two fetches. Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 2945c9b commit 2255af3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Lib/collections/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,8 @@ def __xor__(self, other):
932932
if newcount:
933933
result[elem] = newcount
934934
for elem, count in other.items():
935-
if elem not in self:
936-
newcount = abs(count)
937-
if newcount:
938-
result[elem] = newcount
935+
if elem not in self and count:
936+
result[elem] = abs(count)
939937
return result
940938

941939
def __pos__(self):

0 commit comments

Comments
 (0)