Hacker News new | ask | show | jobs
by _ZeD_ 1010 days ago
or you could just be eager and use lists:

    >>> [[(i, j) for i in "abc"] for j in range(3)]
    [[('a', 0), ('b', 0), ('c', 0)], [('a', 1), ('b', 1), ('c', 1)], [('a', 2), ('b', 2), ('c', 2)]]
1 comments

Right, creating generators in a loop is not usually something you want to do, but it's meant to demonstrate the complexity that arises from late binding rather than demonstrate something you would actually want to do in a real program.