Thorsten Kampe <thors...@thorstenkampe.de> writes:

> [((1, 4), 7), ((1, 4), 8), ((1, 5), 7), ((1, 5), 8), ((2, 4), 7), ((2, 
> 4), 8), ((2, 5), 7), ((2, 5), 8)]

[...]

> What's the best way to pre-process the arguments to "itertools.product" 
> or to post-process the result of "itertools.product" to get what I 
> want?!

Python has powerful destructuring capabilities:

        [(x, y, z) for ((x, y), z) in lopsided_list]

This seems simpler and is probably faster than a generalized flatten for
this size of problem, but I wouldn't use it to rearrange tuples with
more than four or five elements.

-- [mdw]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to