Parent with facade

21 views
Skip to first unread message

Vincent Delecroix

unread,
Aug 19, 2012, 2:54:08 PM8/19/12
to sage-combinat-devel, sage-devel
Hello,

There is a weirdness in the initialization of Parent with a facade.
Consider the following example

class MySet(Parent):
def __init__(self):
Parent.__init__(self, category=(FiniteEnumeratedSets(), Monoids()))

The category of an instance of MySet is just a join of the two
categories. When I add a facade argument to the initialization of
Parent as in

class MyFacadeSet(Parent):
def __init__(self):
Parent.__init__(self, category=(FiniteEnumeratedSets(),
Monoids()), facade=FreeMonoid(2, 'ab'))

I got the error "AttributeError: 'tuple' object has no attribute
'is_subcategory'". It is few lines in Parent.__init__ but I suspect
that some ticket solves the problem yet. Does anybody know what should
I do?

Best,
Vincent

David Roe

unread,
Aug 19, 2012, 4:35:57 PM8/19/12
to sage-...@googlegroups.com, sage-combinat-devel
I don't know if there's a ticket, but one way to fix it is to make the
following two lines of parent.Parent.__init__

else:
category = Category.join((category, Sets().Facades()))

into

if category is None:
category = Sets().Facades()
else:
if isinstance(category, (list, tuple)):
category = Category.join(tuple(category) +
(Sets().Facades(),))
else:
category = Category.join((category, Sets().Facades()))

David

On Sun, Aug 19, 2012 at 12:54 PM, Vincent Delecroix
> --
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
>
>

Nicolas M. Thiery

unread,
Aug 19, 2012, 6:02:47 PM8/19/12
to sage-comb...@googlegroups.com, sage-devel
I'll check this out tomorrow, but I suspect I simply screwed up this
use case. Unless there is a patch in the Sage-Combinat queue touching
those lines, I guess you are just the first one hitting it! The tuple
should be converted to a category before amending it with Facade.
Do you want me to handle this in the "more functorial construction
patch" since anyway it touches facades? Otherwise, go ahead.

Cheers,
Nicolas
--
Nicolas M. Thi�ry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/

vdelecroix

unread,
Aug 20, 2012, 12:23:08 AM8/20/12
to sage-devel, sage-combinat-devel
Hi Nicolas, Hi David,

Thanks for your answers.

> I'll check this out tomorrow, but I suspect I simply screwed up this
> use case. Unless there is a patch in the Sage-Combinat queue touching
> those lines, I guess you are just the first one hitting it! The tuple
> should be converted to a category before amending it with Facade.
> Do you want me to handle this in the "more functorial construction
> patch" since anyway it touches facades? Otherwise, go ahead.

For now, I create a tiny correcting patch along Davids' lines. I will
see if it fit with sage-combinat and then create a ticket. Anyway,
Nicolas, if you can handle it in a better way it's ok.

Best,
Vincent
Reply all
Reply to author
Forward
0 new messages