cross-product

How to compute the cross-product?

I have the following piece of pseudo-C/Java/C# code: int a[]= { 30, 20 }; int b[] = { 40, 50 }; int c[] = {12, 12}; How do I compute the cross-product ABxAC? ...

What should itertools.product() yield when supplied an empty list?

I guess it's an academic question, but the second result does not make sense to me. Shouldn't it be as thoroughly empty as the first? What is the rationale for this behavior? from itertools import product one_empty = [ [1,2], [] ] all_empty = [] print [ t for t in product(*one_empty) ] # [] print [ t for t in product(*all_empty) ] #...