Q:

intersection of multiple sets in a list

Ok, so I want/need to use the "|: operator
Say I have a list:
list = [{1,2,3},{2,3,4},{3,4,5},{4,5,6}]

I need to find the intersection of the list without using: 
    set.intersection(*L)
Ideally I'd like to use a function with a for loop (or nested for loops) to get return the intersections of all of the sets in the list:
isIntersction(L) = {1,2,3,4,5,6}

Thanks

A:

>>> L=[{1,2,3},{2,3,4},{3,4,5},{4,5,6}]
>>> from itertools import chain
>>> set(chain.from_iterable(L))
{1, 2, 3, 4, 5, 6}

A:

Try this, using list comprehension
list = [{1,2,3},{2,3,4},{3,4,5},{4,5,6}]
b = []
[b.append(x) for c in list for x in c if x not in b]
print b # or set(b)

Output:
[1, 2, 3, 4, 5, 6]

If you are keen on having the output as a set, try this:
b = set([])
[b.add(x) for c in list for x in c if x not in b]
print b

Output:
set([1, 2, 3, 4, 5, 6]) #or {1, 2, 3, 4, 5, 6}

If you want a function try this:
def Union(L):
    b = []
    [b.append(x) for c in L for x in c if x not in b]
    return set(b)

