Opened 10 years ago

Closed 7 years ago

# `cartesian_product` AssertionError

Reported by: Owned by: eviatarbach sage-combinat major sage-duplicate/invalid/wontfix combinatorics Frédéric Chapoton, Vincent Delecroix N/A

### Description

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

```sage: cartesian_product([[0,1]])
AssertionError:
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.

### comment:1 Changed 9 years ago by jdemeyer

Milestone: sage-5.11 → sage-5.12

### comment:2 Changed 9 years ago by vbraun_spam

Milestone: sage-6.1 → sage-6.2

### comment:3 Changed 9 years ago by vbraun_spam

Milestone: sage-6.2 → sage-6.3

### comment:4 Changed 9 years ago by vbraun_spam

Milestone: sage-6.3 → sage-6.4

### comment:5 Changed 7 years ago by vdelecroix

Milestone: sage-6.4 → sage-duplicate/invalid/wontfix new → needs_review

Hello,

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__
FiniteEnumeratedSet_with_category
FiniteEnumeratedSet_with_category
Set_object_enumerated_with_category
Set_object_enumerated_with_category
```

Vincent

### comment:6 Changed 7 years ago by chapoton

Reviewers: → Frédéric Chapoton, Vincent Delecroix needs_review → positive_review

ok, I agree

### comment:7 Changed 7 years ago by vbraun

Resolution: → fixed positive_review → closed
Note: See TracTickets for help on using tickets.