"combinations()" is a built in. No need to re-implement it. Also, nested [... for ... for ... for] is silly. Just use "product()", documented on the same page.
[''.join(card) for card in product('123', 'RGP', '@O=', 'OSD')]
They say that six months after learning the itertools module, people give up on Python for Lisp. Which would be hilarious, in your case.
"[...] about itertools -- I guess I got the impression that itertools is deprecated in 3.0, or at least that Guido doesn't much like it, so I have stayed away from it. And itertools.combinations is only in 2.6, so I think I will leave things as is, for those still stuck in 2.5."
Combinations is also in +3.0. Otherwise a valid concern. (Been burned by that one myself.)
I can't find the source, but there might be some confusion between map/filter/reduce and itertools. Guido does not like map/filter/reduce and wants to get rid of them.
Itertools is a huge part of Python 3.0. Everything is an iterator in the language. And the docs underwent a major rewrite with the 3.0 release. It is not going to be deprecated.
http://docs.python.org/library/itertools.html
"combinations()" is a built in. No need to re-implement it. Also, nested [... for ... for ... for] is silly. Just use "product()", documented on the same page.
[''.join(card) for card in product('123', 'RGP', '@O=', 'OSD')]
They say that six months after learning the itertools module, people give up on Python for Lisp. Which would be hilarious, in your case.