Ticket #13801 (closed defect: fixed)

Opened 5 months ago

Last modified 3 months ago

Fix facade set category initialisation

Reported by: vdelecroix Owned by: vdelecroix
Priority: major Milestone: sage-5.8
Component: categories Keywords: category, facade, days45
Cc: sstarosta Work issues:
Report Upstream: N/A Reviewers: Travis Scrimshaw
Authors: Vincent Delecroix Merged in: sage-5.8.beta0
Dependencies: Stopgaps:

Description (last modified by vdelecroix) (diff)

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.

Attachments

trac_13801-fix_facade_initialisation-vd.patch Download (3.0 KB) - added by vdelecroix 3 months ago.

Change History

comment:1 Changed 5 months ago by vdelecroix

  • Status changed from new to needs_review
  • Description modified (diff)

comment:2 follow-up: ↓ 4 Changed 4 months ago by slabbe

Note: you may use ReST syntax for citing trac ticket :

:trac:`12796`

comment:4 in reply to: ↑ 2 ; follow-up: ↓ 6 Changed 3 months ago by vdelecroix

Replying to slabbe:

Note: you may use ReST syntax for citing trac ticket :

:trac:`12796`

That's now done.

comment:5 Changed 3 months ago by vdelecroix

I modified the behavior of facade_for() in the way it was discussed on combinat-devel (see comment:3 of Travis).

Changed 3 months ago by vdelecroix

comment:6 in reply to: ↑ 4 Changed 3 months ago by vdelecroix

Replying to vdelecroix:

Replying to slabbe:

Note: you may use ReST syntax for citing trac ticket :

:trac:`12796`

That's now done.

Actually, I missed one and now it's done!

comment:7 Changed 3 months ago by tscrim

  • Keywords facade, days45 added; facade removed
  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Looks good to me now. Thanks Vincent.

Travis

comment:8 Changed 3 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Milestone changed from sage-5.7 to sage-5.8

comment:9 Changed 3 months ago by tscrim

Was this merged in 5.7.rc0?

comment:10 Changed 3 months ago by jdemeyer

  • Status changed from closed to new
  • Resolution fixed deleted

No.

comment:11 Changed 3 months ago by jdemeyer

  • Status changed from new to needs_review

comment:12 Changed 3 months ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:13 Changed 3 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.8.beta0
Note: See TracTickets for help on using tickets.