Yo !

Uh, cartesian_product and CartesianProduct on same system. My love-hate 
> -relationship to Sage just moved slightly to hate-side. 
>

Please, be respectful of other people's work and focus your hate on Sage's 
categories. The rest is quite fine :-P

I only wanted to add on the same topic that you should beware of everything 
related to categories, and that unless you want something more complicated 
than "just a cartesian product in order to list its elements", it is better 
and safer to use itertools.

What you asked in your first post can be done with

from itertools import product
product(range(n),repeat=n)

And if you want the product of more complicated things (with sets of 
different size) you can use the trick that was first proposed above, i.e.:

product(* [range(x) for x in [2,2,2,3,3,3,2,3]] )

Nathann

P.S. : Sage is open source: when you hate something, come and change it. 
Unless it's categories, in which case you're stuck.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to