Copy a set

suggest change

Sets also have a copymethod. You can use this method to perform a shallow copy.

>>> s1 = {()}
>>> s2 = s1.copy()
>>> s1 is s2
False
>>> s2.add(3)
>>> s1
{[]}
>>> s2
{3,[]}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents