On Tue, Nov 8, 2016 at 1:47 PM, Simon King <simon.k...@uni-jena.de> wrote: > Hi Martin, > > On 2016-11-08, 'Martin R' via sage-devel <sage-devel@googlegroups.com> wrote: >> That's actually precisely what I'd like. So, what are metaclass conflicts? > > Many classes in Sage have metaclasses, such as: Everything that inherits > from sage.structure.element.Element or from > sage.structure.unique_representation.UniqueRepresentation (which is most > parents and all categories). > > Now, if you want to create a new class with more than one base class, > i.e. > class C(B1,B2,B3): > pass > and if the metaclasses M1,M2,M3 of B1,B2,B3 are incompatible (in the > sense that none of M1,M2,M3 is a subclass of the other two metaclasses), > then Python will throw up an error --- unless you explicitly specify a > metaclass for C that is a subclass of M1, M2 and M3.
Yep, exactly. As Simon wrote you have to make a new metaclass that inherits from both InheritDocstrings, and whatever other metaclasses are used by your subclass(es). Fortuntely, InheritDocstrings is implemented [1] in such a way that it should compose cleanly with other metaclasses, so this *shouldn't* be too much of a problem. Just something to be aware of and take care with. [1] http://docs.astropy.org/en/stable/_modules/astropy/utils/misc.html#InheritDocstrings -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.