On Sep 20, 1:54 pm, Seth Leija wrote:
> I need to know how to generate a list of combinations/permutations
> (can't remember which it is). Say I have a list of variables:
>
> [a,b,c,d,...,x,y,z]
>
> I am curious if there is an optimized way to generate this:
>
> [[a,b],[a,c],[a,d],...,[x,z],[y,z]]
One of the advantages of using itertools is that it is written in C rather
than Python (at least for CPython) and thus should run significantly faster
than a pure Python implementation.
Chris
On Mon, Sep 20, 2010 at 4:21 PM, Dave Angel wrote:
> On 2:59 PM, Seth Leija wrote:
>
>> I need to kno
On 2:59 PM, Seth Leija wrote:
I need to know how to generate a list of combinations/permutations
(can't remember which it is). Say I have a list of variables:
[a,b,c,d,...,x,y,z]
I am curious if there is an optimized way to generate this:
[[a,b],[a,c],[a,d],...,[x,z],[y,z]]
I currently have
On Sep 20, 3:08 pm, Mark Lawrence wrote:
> On 20/09/2010 21:54, Seth Leija wrote:
>
>
>
>
>
> > I need to know how to generate a list of combinations/permutations
> > (can't remember which it is). Say I have a list of variables:
>
> > [a,b,c,d,...,x,y,z]
>
> > I am curious if there is an optimized
On 20/09/2010 21:54, Seth Leija wrote:
I need to know how to generate a list of combinations/permutations
(can't remember which it is). Say I have a list of variables:
[a,b,c,d,...,x,y,z]
I am curious if there is an optimized way to generate this:
[[a,b],[a,c],[a,d],...,[x,z],[y,z]]
I current
On Mon, Sep 20, 2010 at 2:54 PM, Seth Leija wrote:
> I need to know how to generate a list of combinations/permutations
> (can't remember which it is). Say I have a list of variables:
>
> [a,b,c,d,...,x,y,z]
>
> I am curious if there is an optimized way to generate this:
>
> [[a,b],[a,c],[a,d],..
The itertools module (http://docs.python.org/library/itertools.html) has
both permutations and combinations functionality.
Chris
On Mon, Sep 20, 2010 at 1:54 PM, Seth Leija wrote:
> I need to know how to generate a list of combinations/permutations
> (can't remember which it is). Say I have a
I need to know how to generate a list of combinations/permutations
(can't remember which it is). Say I have a list of variables:
[a,b,c,d,...,x,y,z]
I am curious if there is an optimized way to generate this:
[[a,b],[a,c],[a,d],...,[x,z],[y,z]]
I currently have an iteration that does this:
#li