Skip to content

Remove Duplicate Set Key

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-duplicate-set-key

Section titled “Sourcery refactoring id: remove-duplicate-set-key”

Remove duplicate keys when instantiating sets.

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

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.