Creating unique combinations from lists
"Martin v. Löwis"
martin at v.loewis.de
Thu Jan 17 00:21:03 EST 2008
> The main emphasis was to show that there was a pattern unfolding that
> should have been translated into more pythonic code than just
> hard-coding nested loops.
Practicality beats purity. That you would solve a more general problem
in a more general way doesn't mean that you shouldn't solve the more
specific problem (combinations from three sets) in a specific,
easy-to-read way. Readability counts.
I find your solution (with nested generators) *very* unpythonic. It
is much more complicated than necessary to solve the problem at hand,
and it doesn't get Pythonic just by using the latest language features.
It may be a smart solution, but not a Pythonic one.
Regards,
Martin
P.S. To solve the general problem, I like
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496807
More information about the Python-list
mailing list