From da0847048aa7f934573fa449cea8643def056aa5 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 27 Mar 2019 08:02:28 +0200 Subject: bpo-36431: Use PEP 448 dict unpacking for merging two dicts. (GH-12553) --- Lib/xml/etree/ElementTree.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Lib/xml/etree/ElementTree.py') diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index c1cf483cf5..b5ad8e1d14 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -169,10 +169,8 @@ class Element: if not isinstance(attrib, dict): raise TypeError("attrib must be dict, not %s" % ( attrib.__class__.__name__,)) - attrib = attrib.copy() - attrib.update(extra) self.tag = tag - self.attrib = attrib + self.attrib = {**attrib, **extra} self._children = [] def __repr__(self): @@ -451,8 +449,7 @@ def SubElement(parent, tag, attrib={}, **extra): additional attributes given as keyword arguments. """ - attrib = attrib.copy() - attrib.update(extra) + attrib = {**attrib, **extra} element = parent.makeelement(tag, attrib) parent.append(element) return element -- cgit v1.2.1