You've just created a temp variable that contains exactly this list value.  So I would write:

````python
l = [bc.nodes for bc in bcs if bc.sub_domain not in ['top', 'bottom']]
if l:
    bcids = reduce(np.union1d, l)
````