#19555: Implement a containment for cartesian_product
-------------------------------------+-------------------------------------
       Reporter:  tscrim             |        Owner:  sage-combinat
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Travis Scrimshaw   |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  public/sets/contains_cartesian_product-19555|  
fb14675d6a264ca2405cebbcdb62a3eddfadd1f4
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:2 ncohen]:
 > I admittedly do not know much about such matters, but isn't the problemm
 here that the object is not a 'facade' object, while you expect it to be
 in your bug report?

 More or less. The current generic code (from `sage.structure.parent`)
 tries to compare the tuple with the corresponding object of the cartesian
 product. And they of course compare as different:
 {{{
 sage: C = cartesian_product([srange(5), srange(5)])
 sage: c = C((1,1))
 sage: c
 (1, 1)
 sage: c == (1,1)
 False
 sage: (1,1) == c
 False
 }}}

 Warning: your example is completely broken
 {{{
 sage: C = cartesian_product([range(5), range(5)])
 sage: C((1r,1r))
 (1, 1)
 sage: C((1,1))
 Traceback (most recent call last):
 ...
 TypeError: Cannot convert int to sage.structure.element.Element
 }}}

 Warning++: you can not use `range` and `srange` in the same Sage session
 since `FiniteEnumeratedSet` uses `UniqueRepresentation`... I guess a safer
 way to implement this unique representation, would be to force a common
 universe for the elements... (see #19562)

--
Ticket URL: <http://trac.sagemath.org/ticket/19555#comment:4>
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.

Reply via email to