What distinguishes -
and .difference()
on sets? Obviously the syntax is not the same. One is a binary operator, and the other is an instance method. What else?
s1 = set([1,2,3])
s2 = set([3,4,5])
>>> s1 - s2
set([1, 2])
>>> s1.difference(s2)
set([1, 2])