On Wed, Feb 15, 2012 at 02:47:04PM -0800, Anne Schilling wrote: > Perhaps I need > > __metaclass__ = ClasscallMetaclass > > @staticmethod > def __classcall_private__(cls, p, order = None):
Yes, this sounds like it. You have: sage: type(p) <class 'sage.combinat.posets.posets.LinearExtensionOfPoset'> compared to: sage: type(Core([2,1],4)) <class 'sage.combinat.core.Cores_length_with_category.element_class'> so p does not inherit the category code. Alternatively, instead of having a new LinearExtensionOfPoset(P, [3,1,2]) function, you might want to use an idiom like: sage: P.linear_extension([3,1,2]) whose implementation would do the analogue of what classcall does for Cores, i.e. delegate the work to P.linear_extensions()([3,2,1]). This avoids polluting the main namespace of Sage. There is just the small issue that P.linear_extension already exists as a method, so one needs to keep backward compatibility: sage: P.linear_extension() ... the internal linear extension of P ... sage: P.linear_extension([3,1,2]) ... the linear extension [3,1,2] of P ... Yet another alternative would be to just have: sage: P.linear_extensions()([3,1,2]) Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.