Friday, May 10, 2013

Function Call Can be Replaced by Set Literal

I got this warning in PyCharm today: Function call can be replaced by set literal

It was for the following code:
    hand[unique_id] = set([seat.player])

Basically it means that you don't have to say set([seat.player]) you could just do this:
    hand[unique_id] = {seat.player}

It took a while to process what the message was actually saying...