Hi Bruce,

I think that what you  have is fine. Compare with:

{{{
sage: mu=Partition([3,2])
sage: type(mu)
<class 'sage.combinat.partition.Partitions_all_with_category.element_class'>
}}}

If you try adding a method to `PathTableau`, such as with
{{{
 class PathTableau(ClonableList):

    @abstract_method(optional=False)
    def check(self):
        pass

    def test(self):
        print('a test')
}}}
then you will see that it is inherited:
{{{sage: c=CatalanTableau([0,1,2])
sage: c
[0, 1, 2]
sage: c.test()
}}}


On Wednesday, 13 June 2018 14:08:55 UTC+2, Bruce wrote:
>
> I am trying to implement an Abstract Base Class, but have hit something I 
> don't understand.
>
> I have attached a file with a minimal example of what I am trying to do.
> There is an Element ABC PathTableau and a Parent ABC PathTableaux.
> I then inherit from these with Element CatalanTableau and Parent 
> CatalanTableaux.
>
> PathTableau inherits from CloneableList so I want to do some preprocessing 
> on the
> argument before creating the object. For this minimal example I have 
> removed the
> methods in PathTableau.
>
> My problem is that when I run this I get:
>
> sage: c = CatalanTableau([0,1,0])
> sage: type(c)
> <class '__main__.CatalanTableaux.element_class'>
>
> This is not what I want. I want c to be an instance of CatalanTableau
> and therefore to inherit the (missing) methods from PathTableau.
>
> I suspect it will only take a minor adjustment to get what I want but I 
> don't
> know what that would be.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to