News for hackers. Stuff that matters.
Re:Five-line solution to the Subset-sum problem (Python) by adlpz on Monday February 25, 2013 @05:49AM (#5278280)
Interesting to see actual use of sets on Python. For those like me not familiar with the syntax there, the OR-ing (|=) is just Union minus Intersection (because all elements of a Set are unique).

    >>> {1,2,3} | {2,4,6}
    set([1, 2, 3, 4, 6])
By the way, AND-ing would be a straight intersection

    >>> {1,2,3} & {2,4,6}
    set([2])

There are no comments on this comment yet.