Opened 10 years ago

Closed 7 years ago

#14224 closed defect (fixed)

`cartesian_product` AssertionError

Reported by: eviatarbach Owned by: sage-combinat
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: combinatorics Keywords:
Cc: Merged in:
Authors: Reviewers: Frédéric Chapoton, Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

GitHub link to the corresponding issue


As of now, passing a list, tuple, or set to cartesian_product returns an AssertionError?.

sage: cartesian_product([[0,1]])
sage: cartesian_product([FiniteEnumeratedSet([0,1])])  
The cartesian product of ({0, 1},)

I understand that this function can construct Cartesian products on different categories, so I see why it requires specific types. However, the error message should be more descriptive, especially considering that cartesian_product_iterator([[0,1]]), CartesianProduct([0,1]), and permutations([[0,1]]) all work.

Change History (7)

comment:1 Changed 9 years ago by jdemeyer

Milestone: sage-5.11sage-5.12

comment:2 Changed 9 years ago by vbraun_spam

Milestone: sage-6.1sage-6.2

comment:3 Changed 9 years ago by vbraun_spam

Milestone: sage-6.2sage-6.3

comment:4 Changed 9 years ago by vbraun_spam

Milestone: sage-6.3sage-6.4

comment:5 Changed 7 years ago by vdelecroix

Milestone: sage-6.4sage-duplicate/invalid/wontfix
Status: newneeds_review


I propose to close this one as duplicate since with #18411 tuple/list input are automatically converted into FiniteEnumeratedSet and set/frozenset converted to Set

sage: C = cartesian_product([[1,2], (3,4), set([1,2,3]), frozenset([1,2])])
The cartesian product of ({1, 2}, {3, 4}, {1, 2, 3}, {1, 2})
sage: for c in C.cartesian_factors():
....:     print c.__class__.__name__


comment:6 Changed 7 years ago by chapoton

Reviewers: Frédéric Chapoton, Vincent Delecroix
Status: needs_reviewpositive_review

ok, I agree

comment:7 Changed 7 years ago by vbraun

Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.