c++ has sets but they are not exactly what you think of from math (same as how vectors are not math vectors).
you can sort a c++ list without a set. What purpose does the set do for py? In c++ it could be used to remove duplicates, or other things, but it would be an unnecessary data copy from one container to another in most scenarios.
As Jonnin says, it depends what happens beyond those two lines. But you will have to define an ordering operation (which, given the names, might be non-trivial).
The purpose of sets here is to remove duplicates @jonnin
In the next step I am iterating the left_shapes and checking for the if condition. @lastchance