The code you posted has no problem run under python3 and python2 . If you got this error,it typically means you have reassign set to another object. You should check the code again.
Python 2.7.9 (default, Apr 13 2015, 11:43:15)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.49)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test_dict = {1:"one",2:"two"}
>>> set3=set(test_dict)
>>> print set3
set([1, 2])
>>> set3.add(3)
>>> print set3
set([1, 2, 3])
>>> set3.pop()
1
and in python3 :
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test_dict = {1:"one",2:"two"}
>>> set3=set(test_dict)
>>> print(set3)
{1, 2}
>>> set3.add(3)
>>> print(set3)
{1, 2, 3}
>>> set3.pop()
1
>>> print(set3)
{2, 3}