Pattern for permutations?

Aahz aahz at pythoncraft.com
Sat Apr 6 18:16:00 EST 2002


In article <mailman.1018131433.4336.python-list at python.org>,
Tim Churches  <tchur at optushome.com.au> wrote:
>
>I want to define a function which takes as its argument a
>list which contains one or more sequences, and then does stuff
>with every permutation of the elements of those sequences. For
>example, a function which works for a list containing three
>sequences:
>  [...]
>Is there a better way?

Recursion.  In Python 2.2, implemented with generators.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative."  --jdecker



More information about the Python-list mailing list