• Mutable function arguments

 

Hi there, I've just started out with the very first task and when reviewing other solutions, I stumbled upon this solution:

    def checkio(data):
    for x in set(data):
        if data.count(x) == 1:
            data.remove(x)
    return data

So just for better understanding: the "set(data)" in the for-loop is only executed the first time of execution... if it was executed every loop cycle the parameter of set would be modified and should lead to unpredictable side effects. Am I right with this?

Thanks in advance for any help =)

Klaus

.