[sage-combinat-devel] Re: ClonableIntArray

2016-03-19 Thread Andrew
Hi Simon and Travis,

Thanks for the explanations. I am not sure if there are that many 
additional use cases, but a meta meta class sounds reasonable to me:) As 
always the main problem is finding the right place to look in the 
documentation - or the right person to explain it to you.

Thanks again,
Andrew

On Thursday, 17 March 2016 01:10:44 UTC+11, Simon King wrote:
>
> Hi Andrew, 
>
> On 2016-03-16, Andrew wrote: 
> > I want this functionality too. I tried adding: 
> > 
> > __metaclass__ = ClasscallMetaclass 
> > 
> > but this produces the error: 
> > 
> > TypeError: Error when calling the metaclass bases 
> > metaclass conflict: the metaclass of a derived class must be a (non- 
> > strict) subclass of the metaclasses of all its bases 
>
> That's a general problem. The point is: If a class C with a meta-class M 
> has several base classes B1,...,Bn with meta-classes M1,...,Mn, then 
> Python will give you that error unless one of the meta-classes is 
> a sub-class of all other meta-classes. 
>
> By consequence, if we want to combine the features provided by the 
> meta-classes M, M1, M2,... then we need to explicitly create another 
> meta-class Mx that combines the features from the other meta-classes. 
> And then you have to explicitly invoke Mx for C, rather than just inherit 
> it from M and the meta-classes of C's base classes. 
>
> I once tried to solve that problem, by introducing a meta-meta-class MM. 
> I.e., each meta-class M, M1, M2,... in Sage would be instance of MM, and 
> when you try to combine their features, then MM would create a common 
> sub-meta-class Mx of M, M1, M2, ... on the fly (i.e., what we now have 
> to do manually would become automatic). 
>
> It did work. But I guess that idea is just too confusing and the use 
> cases (at that time) have been too few. Perhaps there are more use cases 
> now? 
>
> Best regards, 
> Simon 
>
>

-- 
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.


[sage-combinat-devel] Re: ClonableIntArray

2016-03-19 Thread Simon King
Hi Andrew,

On 2016-03-16, Andrew  wrote:
> I want this functionality too. I tried adding:
>
> __metaclass__ = ClasscallMetaclass
>
> but this produces the error:
>
> TypeError: Error when calling the metaclass bases
> metaclass conflict: the metaclass of a derived class must be a (non-
> strict) subclass of the metaclasses of all its bases

That's a general problem. The point is: If a class C with a meta-class M
has several base classes B1,...,Bn with meta-classes M1,...,Mn, then
Python will give you that error unless one of the meta-classes is
a sub-class of all other meta-classes.

By consequence, if we want to combine the features provided by the
meta-classes M, M1, M2,... then we need to explicitly create another
meta-class Mx that combines the features from the other meta-classes.
And then you have to explicitly invoke Mx for C, rather than just inherit 
it from M and the meta-classes of C's base classes.

I once tried to solve that problem, by introducing a meta-meta-class MM.
I.e., each meta-class M, M1, M2,... in Sage would be instance of MM, and
when you try to combine their features, then MM would create a common
sub-meta-class Mx of M, M1, M2, ... on the fly (i.e., what we now have
to do manually would become automatic).

It did work. But I guess that idea is just too confusing and the use
cases (at that time) have been too few. Perhaps there are more use cases
now?

Best regards,
Simon

-- 
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.