Why does PyCharm invite me to convert a list to a set?

By creating the following list:

NO_VACANCIES = ['no vacancies', 
                'not hiring', 
                'no open positions',
                'all positions are currently filled'
                'no positions are available'
                "don't have any vacancies"
                "we don't have any jobs available"
                "we don't have any positions available"
                'no positions are currently available']

... PyCharm suggested converting it to set, but gave no excuses:

enter image description here

What could be the benefits of such a conversion?

+4
source share
1 answer

The menu you show is not an offer; it is a tool (known as an “action of intent”). This gives you the opportunity to change this list to a set if you decide that you need a set instead of a list. He does not tell you that this list should be a set or that a set is somehow better at all.

+2
source

Source: https://habr.com/ru/post/1627170/


All Articles