#18411: get rid of CartesianProduct
-------------------------+-------------------------------------------------
Reporter: | Owner:
vdelecroix | Status: needs_review
Type: | Milestone: sage-6.9
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers: Nicolas ThiƩry
combinatorics | Work issues:
Keywords: | Commit:
Authors: | 22f8b77a3cc2223863396f8d422fbbeec51d1656
Vincent Delecroix | Stopgaps:
Report Upstream: N/A |
Branch: |
public/18411 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by nthiery):
Replying to [comment:39 vdelecroix]:
> If we switch back, only the following fails (from
`sage.combinat.tutorial`):
> {{{
> sage: Suits = Set(["Hearts", "Diamonds", "Spades", "Clubs"])
> sage: Values = Set([2, 3, 4, 5, 6, 7, 8, 9, 10,
> ....: "Jack", "Queen", "King", "Ace"])
> sage: Cards = cartesian_product([Values, Suits])
> sage: Hands = Subsets(Cards, 5)
> Traceback (most recent call last):
> ...
> AttributeError: 'CartesianProduct_with_category' object has no attribute
'list'
> }}}
> and the reason is because you can not do the list of `Cards`...
> {{{
> sage: list(Cards)
> Traceback (most recent call last):
> ...
> AttributeError: 'CartesianProduct_with_category' object has no attribute
'list'
> }}}
>
> There are of course other ways to fix it, but I found that it was the
simplest. Using `FiniteEnumeratedSet` instead of `Set` in the tutorial
seems unnatural to me since you want to keep it as simple as possible...
I tend to agree indeed; this would be annoying.
Maybe we should eventually make the distinction between sets, sets
admitting an iterator, and sets with a distinguished enumeration.
For now, let's say that this will do, unless someone has some additional
insight to provide.
Still, any thought about moving this feature to
Sets.Finite.CartesianProducts?
--
Ticket URL: <http://trac.sagemath.org/ticket/18411#comment:40>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.