All permutations of a list
Emile van Sebille
emile at fenx.com
Mon Oct 23 00:13:30 EDT 2000
never mind ...
doesn't-help-that-it-calls-perms-ly y'rs
--
Emile van Sebille
emile at fenx.com
-------------------
"Emile van Sebille" <emile at fenx.com> wrote in message
news:8t08bb$lnvu5$1 at ID-11957.news.cis.dfn.de...
> "Rainer Deyke" <root at rainerdeyke.com> wrote in message
> news:9nNI5.110763$g6.50159527 at news2.rdc2.tx.home.com...
>
> <snip>
>
>
> > Here's my short Pythonic permutation function:
> >
> > def perms(list):
> > if list == []:
> > return [[]]
> > return [[list[i]] + p for i in range(len(list))\
> > for p in perms(list[:i] + list[i+1:])]
> >
>
> ... which permutes into...
>
> def perms3(list):
> return not [list] or [[list[i]] + p for i in
> range(len(list))\
> for p in perms(list[:i] + list[i+1:])]
>
>
>
> --
>
> Emile van Sebille
> emile at fenx.com
> -------------------
>
>
>
More information about the Python-list
mailing list