On Dec 26, 2007 3:49 AM, Gary Ruben [EMAIL PROTECTED] wrote:
Sorry this isn't an answer, just noise, but for those here who don't
know, Bruce is the chief maintainer of the vpython project. I have found
vpython aka the visual module to be a highly attractive and useful
module for teaching
Le Mercredi 26 Décembre 2007 21:22, Mathew Yeates a écrit :
Hi
I've been looking at fromfunction and itertools but I'm flummoxed.
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=[dog,cat]
r2=[1,2]
I want to return
On Dec 26, 2007 12:22 PM, Mathew Yeates [EMAIL PROTECTED] wrote:
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=[dog,cat]
r2=[1,2]
I want to return [[dog,1],[dog,2],[cat,1],[cat,2]]
It's obvious when the number of lists is not
Hi --
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=[dog,cat]
r2=[1,2]
I want to return [[dog,1],[dog,2],[cat,1],[cat,2]]
Try this:
In [25]: [(x, y) for x in r1 for y in r2]
Out[25]: [('dog', 1), ('dog', 2), ('cat', 1), ('cat', 2)]
Which reference manual?
René Bastian wrote:
Le Mercredi 26 Décembre 2007 21:22, Mathew Yeates a écrit :
Hi
I've been looking at fromfunction and itertools but I'm flummoxed.
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=[dog,cat]
yes, I came up with this and may use it. Seems like it would be insanely
slow but my problem is small enough that it might be okay.
Thanks
Keith Goodman wrote:
On Dec 26, 2007 12:22 PM, Mathew Yeates [EMAIL PROTECTED] wrote:
I have an arbitrary number of lists. I want to form all
On Dec 26, 2007 2:30 PM, Charles R Harris [EMAIL PROTECTED] wrote:
On Dec 26, 2007 1:45 PM, Keith Goodman [EMAIL PROTECTED] wrote:
On Dec 26, 2007 12:22 PM, Mathew Yeates [EMAIL PROTECTED] wrote:
I have an arbitrary number of lists. I want to form all possible
combinations from all
On Dec 26, 2007 1:45 PM, Keith Goodman [EMAIL PROTECTED] wrote:
On Dec 26, 2007 12:22 PM, Mathew Yeates [EMAIL PROTECTED] wrote:
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=[dog,cat]
r2=[1,2]
I want to return
Thanks Chuck.
Charles R Harris wrote:
On Dec 26, 2007 2:30 PM, Charles R Harris [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
On Dec 26, 2007 1:45 PM, Keith Goodman [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
On Dec 26, 2007 12:22 PM, Mathew Yeates [EMAIL
Here's a baroque way to do it using generated code:
def cg_combinations(seqs):
n = len(seqs)
chunks = [def f(%s): % ', '.join('s%s' % i for i in range(n))]
for i in reversed(range(n)):
chunks.append( * (n -i) + for x%s in s%s: % (i, i))
Hi all,
I use numpy's own ndindex() for tasks like these:
In: numpy.ndindex?
Type: type
Base Class: type 'type'
String Form:class 'numpy.lib.index_tricks.ndindex'
Namespace: Interactive
File: /Library/Frameworks/Python.framework/Versions/2.4/
Gary Ruben wrote:
Sorry this isn't an answer, just noise, but for those here who don't
know, Bruce is the chief maintainer of the vpython project. I have found
vpython aka the visual module to be a highly attractive and useful
module for teaching physics. It would be great if someone with
12 matches
Mail list logo