some sort of permutations...
Bill Mill
bill.mill at gmail.com
Tue Apr 12 08:41:15 EDT 2005
On Apr 12, 2005 2:37 AM, Fredrik Lundh <fredrik at pythonware.com> wrote:
> "Bernard A." wrote:
>
> > i'm looking for a way to have all possible length fixed n-uples from a
> > list, i think generators can help, but was not able to do it myself,
> > maybe some one could point me out to an idea to do it ?
>
> did you try googling for "python permutations" ?
>
> here's the first hit:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
>
I've used that recipe a significant amount, and I feel like its
recursion really slows it down (but I haven't been profiled it). Does
anyone know of a non-recursive algorithm to do the same thing?
And, while I'm asking that question, is there a good reference for
finding such algorithms? Do most people keep an algorithms book handy?
Peace
Bill Mill
bill.mill at gmail.com
More information about the Python-list
mailing list