As @Claudiu explained well such problems are NP complete, and you can not solve them in a efficient or general way, but in this case as a special and not much efficient way you can play itertools
module like following :
>>> from itertools import combinations,product,chain
>>> length=len(B)
>>> subset_lenght=[(i,j,k) for i,j,k in combinations(range(1,length),3) if i+j+k==length]
>>> all_combinations={i:combinations(B,i) for i in range(1,length-2)}
>>> for i,j,k in subset_lenght:
... for t,p,m in product(all_combinations[i],all_combinations[j],all_combinations[k]):
... if not set(t)&set(p)&set(m) and map(sum,(t,p,m))==A:
... print chain.fromiterable(t,p,m)
In this approach first of all you need all the possible lengths which those sum is equal to your main list length, for that aim you can use following list comprehension :
>>> [(i,j,k) for i,j,k in combinations(range(1,len(B)),3) if i+j+k==len(B)]
[(1, 2, 17), (1, 3, 16), (1, 4, 15), (1, 5, 14), (1, 6, 13), (1, 7, 12), (1, 8, 11), (1, 9, 10), (2, 3, 15), (2, 4, 14), (2, 5, 13), (2, 6, 12), (2, 7, 11), (2, 8, 10), (3, 4, 13), (3, 5, 12), (3, 6, 11), (3, 7, 10), (3, 8, 9), (4, 5, 11), (4, 6, 10), (4, 7, 9), (5, 6, 9), (5, 7, 8)]
Then you need to get all the combinations of the main list with the length 1 to len(main_list)-3
(17 in this case but since the range doesn't contains the last number we will put a number 1 grater) so, since we need to access this combinations with those length we can use a dict comprehension to create a dictionary with the partition length as key and the combinations as value :
>>> all_combinations={i:combinations(B,i) for i in range(1,length-2)}
And at last you need to get the the combinations based on subset_lenght
items and then choose the ones that hasn't any intersection and those sum is equal to those corresponding item in A
.