[sage-support] Re: Element vs UniqueRepresentation

2016-10-07 Thread Nils Bruin
On Friday, October 7, 2016 at 10:47:55 AM UTC-7, John H Palmieri wrote: > > 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 > Yes, python doesn't support multiple meta

[sage-support] Re: Element vs UniqueRepresentation

2016-10-08 Thread John H Palmieri
On Friday, October 7, 2016 at 6:21:45 PM UTC-7, Nils Bruin wrote: > > On Friday, October 7, 2016 at 10:47:55 AM UTC-7, John H Palmieri wrote: >> >> TypeError: Error when calling the metaclass bases >> metaclass conflict: the metaclass of a derived class must be a >> (non-strict) subclass of

[sage-support] Re: Element vs UniqueRepresentation

2016-10-08 Thread Nils Bruin
On Saturday, October 8, 2016 at 8:43:33 AM UTC-7, John H Palmieri wrote: > > > What are all of the drawbacks? > > The ones I am aware of: - the construction parameters need to be cached. That might have lifetime implications for them. - construction parameters need to be processed for hashing et

[sage-support] Re: Element vs UniqueRepresentation

2016-10-09 Thread Nils Bruin
On Saturday, October 8, 2016 at 12:12:30 PM UTC-7, Nils Bruin wrote: > > On Saturday, October 8, 2016 at 8:43:33 AM UTC-7, John H Palmieri wrote: >> >> >> What are all of the drawbacks? >> >> The ones I am aware of: > - the construction parameters need to be cached. That might have lifetime > imp

[sage-support] Re: Element vs UniqueRepresentation

2016-10-10 Thread Simon King
Hi Jeroen, On 2016-10-10, Jeroen Demeyer wrote: > Try this: > > sage: from sage.misc.inherit_comparison import > InheritComparisonClasscallMetaclass > sage: class A(Element, UniqueRepresentation): > : __metaclass__ = InheritComparisonClasscallMetaclass In other words, we have custom mad

[sage-support] Re: Element vs UniqueRepresentation

2016-10-10 Thread Simon King
Hi Jeroen, On 2016-10-10, Jeroen Demeyer wrote: > On 2016-10-10 10:47, Simon King wrote: >> The meta-metaclass would take the >> atomic metaclasses appearing in the bases of a class definition "Foo", >> and would automatically/dynamically create a composed metaclass, that >> combines all the feat

[sage-support] Re: Element vs UniqueRepresentation

2016-10-10 Thread Simon King
Hi Jeroen, On 2016-10-10, Simon King wrote: >> The metaclass of B1 is responsible for constructing the class X (in >> particular, the metaclass of B1 can decide the metaclass of X). In >> Python 3, the metaclass of X is resolved by a hard-coded algorithm >> _PyType_CalculateMetaclass and then

[sage-support] Re: Element vs UniqueRepresentation

2016-10-11 Thread Simon King
Hi Jeroen, On 2016-10-10, Jeroen Demeyer wrote: > Maybe I'm misunderstanding you, but what I wanted to say is: Python 3 > doesn't have any place to hook a custom metaclass. Is there a way to have a metaclass similar to our ClasscallMetaclass at all, in Python3?? I just tested, having class Cla

[sage-support] Re: Element vs UniqueRepresentation

2016-10-11 Thread Simon King
["Followup-To:" nach gmane.comp.mathematics.sage.devel gesetzt.] On 2016-10-11, Simon King wrote: > Hi Jeroen, > > On 2016-10-10, Jeroen Demeyer wrote: >> Maybe I'm misunderstanding you, but what I wanted to say is: Python 3 >> doesn't have any place to hook a custom metaclass. > > Is there a wa

Re: [sage-support] Re: Element vs UniqueRepresentation

2016-10-08 Thread Jori Mäntysalo
On Sat, 8 Oct 2016, Nils Bruin wrote: What are all of the drawbacks? The ones I am aware of: Also random testing for a hypotheses is hard. I can generate infinitely many random graphs in a loop and try to found a counterexample, but the same does not apply to posets. -- Jori Mäntysa

Re: [sage-support] Re: Element vs UniqueRepresentation

2016-10-10 Thread Jeroen Demeyer
On 2016-10-10 10:47, Simon King wrote: The meta-metaclass would take the atomic metaclasses appearing in the bases of a class definition "Foo", and would automatically/dynamically create a composed metaclass, that combines all the features of the given atomic metaclasses and would serve as the me

Re: [sage-support] Re: Element vs UniqueRepresentation

2016-10-10 Thread Jeroen Demeyer
On 2016-10-10 17:31, Simon King wrote: I just tested that in the current Sage development version my proof-of-concept would still work. But still Python 2, right? And looking at _PyType_CalculateMetaclass, I don't see why it wouldn't work in Python3. Maybe I'm misunderstanding you, but what