On May 31, 9:23 pm, Johannes Bauer <dfnsonfsdu...@gmx.de> wrote:
> I'm trying to write a function in Python which does the following: For a
> number of arguments which are all lists, return a list (or generator)
> which yields all tuples of combination. E.g:
>
> foofunction()
> # returns [ ]

Are you sure that's what you want?  I'd expect [()] here (on the
basis that the empty product is a one-element set).  And
indeed that's what itertools.product gives:

>>> import itertools
>>> list(itertools.product())
[()]

> foofunction([1, 2, 3])
> # returns [ (1), (2), (3) ]

Presumably you mean [(1,), (2,), (3,)] here?

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to