#13801: Fix facade set category initialisation
-------------------------------------+--------------------------------------
       Reporter:  vdelecroix         |         Owner:  vdelecroix  
           Type:  defect             |        Status:  needs_review
       Priority:  major              |     Milestone:  sage-5.6    
      Component:  categories         |    Resolution:              
       Keywords:  category, facade   |   Work issues:              
Report Upstream:  N/A                |     Reviewers:              
        Authors:  Vincent Delecroix  |     Merged in:              
   Dependencies:                     |      Stopgaps:              
-------------------------------------+--------------------------------------
Changes (by vdelecroix):

  * status:  new => needs_review


Old description:

> Facade sets are used in many places but there are two small errors that
> prevent from using it everywhere...
>
> Here is the first error
> {{{
> class A(Parent):
>     def __init__(self):
>         Parent.__init__(self, facade=True,
> category=((FiniteEnumeratedSets(),Monoids()))
> }}}
> for which we get
> {{{
> sage: A()
> Traceback (most recent call last):
> ...
> AttributeError: 'tuple' object has no attribute 'is_subcategory'
> }}}
>
> And the second conerns the behavior of .facade_for() which is better
> explained with a minimal example
> {{{
> class B(Parent):
>     def __init__(self):
>         Parent.__init__(self, category=Sets(), facade=True)
> }}}
> for which we get
> {{{
> sage: b = B()
> sage: b.facade_for()
> Traceback (most recent call last):
> ...
> AttributeError: 'B_with_category' object has no attribute '_facade_for'
> }}}

New description:

 Facade sets are used in many places but there are two small errors that
 prevent from using it everywhere...

 The first error concerns multiple categories initialisation. Here is a
 minimal example
 {{{
 class A(Parent):
     def __init__(self):
         Parent.__init__(self,
             category=((FiniteEnumeratedSets(),Monoids()),
             facade=True)
 }}}
 for which we get
 {{{
 sage: A()
 Traceback (most recent call last):
 ...
 AttributeError: 'tuple' object has no attribute 'is_subcategory'
 }}}

 The second problem concerns the behavior of .facade_for() which is better
 explained with a minimal example
 {{{
 class B(Parent):
     def __init__(self):
         Parent.__init__(self, category=Sets(), facade=True)
 }}}
 for which we get
 {{{
 sage: b = B()
 sage: b.facade_for()
 Traceback (most recent call last):
 ...
 AttributeError: 'B_with_category' object has no attribute '_facade_for'
 }}}

 The ticket provides the (trivial) corrections for both problems and add
 two doctests.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13801#comment:1>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to