Skip to content

Remove Duplicate Set Key

Sourcery refactoring id: remove-duplicate-set-key

Description:

Remove duplicate keys when instantiating sets.

Before:

addresses = {"here", *address_list1, *address_list2, *address_list1, "there", "here"}

After:

addresses = {*address_list2, *address_list1, "there", "here"}

Explanation:

Set keys must be unique. Hence, repeated keys are redundant and can be removed from its inialization to increase the conciseness and clarity of the code.

Back to top