Remove Redundant Constructor in Dict Union
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery refactoring id: remove-redundant-constructor-in-dict-union
Section titled “Sourcery refactoring id: remove-redundant-constructor-in-dict-union”Description
Section titled “Description”Before
Section titled “Before”x = dict(y) | zx = y | zExplanation
Section titled “Explanation”The Python dictionary union operator returns a new dictionary, without modifying any of its operands. As a result, dictionary copies or reconstructions are unnecessary, and clutter the code.
See also: unwrap-iterable-construction,
dict-assign-update-to-union