N
N
nihi1ist2022-01-21 19:52:32
Python
nihi1ist, 2022-01-21 19:52:32

Why does Pycharm complain about "Function call can be replaced with set literal" code?

I'm trying to get a set and a dictionary:
set((*dict, *dict.values()))

I get a warning:

Function call can be replaced with set literal

Though the code fulfills correctly. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Ukrainskiy, 2022-01-21
@nihi1ist

Well, firstly, he does not swear, he just advises a more elegant solution.
{*dict, *dict.values()}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question