Can someone please explain what is going on?
>>> xx = ({1,2}, {2,3}, {3,4}, {4,2})
>>> yy = [x.discard(2) for x in xx]
>>> yy
[None, None, None, None]
>>> xx
({1}, {3}, {3, 4}, {4})
>>> id(xx)
4315823704
>>> id(yy)
4315797064
I'd expected yy
to be equal to [{1}, {3}, {3, 4}, {4}]
and xx
to remain untouched!