Python

Python

Made by DeepSource

Adding to set immediately following its definition PY-W0071

Anti-pattern
Major
Autofix

Instead of addepts items to a set just after creation, it should be refactored to add those items into the set definition itself.

Bad practice

trees = set()
trees.add('cedar')
trees.add('oak')

Recommended

trees = {'cedar', 'oak'}