In Java I like to use the Boolean value returned by an \"add to the set\" operation to test whether the element was already present in the set:
if (set.add(\
I guess, in Python is basically add y to your set if needed and doesn't return anything. You can test if y is already in z if you would like to know if the add will change anything.
Here some tests you can do in iPython :
In [2]: z = set()
In [3]: y = 4
In [4]: z.add(y)
In [5]: t = z.add(y)
In [6]: t
In [7]: print t
None