Hi Travis, I can't find any combination that works.
class MyCategory(Category_singleton): class ParentMethods: class Endset(CategoryWithAxiom): def x1(self): return self.identity() class ElementMethods: class Endset(CategoryWithAxiom): def x2(self): return self.identity() class Endset(CategoryWithAxiom): class ParentMethods: def x3(...) class ELementMethods: def x4(...) (& similar with MorphismMethods) I don't see any of these methods when I do tab-completion on an endomorphism set in my category. In this case I want to do something simple: define a method "one()" that just returns "self.identity()", since the standard definition of "one" in a homset doesn't seem very sensible. But I only plan to do it in one particular case, because I don't know if it's a good idea to do it everywhere, plus also it seems like a good thing to know how to do for homsets more generally. John On Thursday, July 28, 2016 at 6:42:42 PM UTC-7, Travis Scrimshaw wrote: > > Hey John, > I think in this case you want ElementMethods because your putting this > in the category of endomorphism, whose elements are the morphisms. The next > thing I think of is MorphismMethods, but that would apply to all morphisms > IIRC. > > Best, > Travis > > > On Thursday, July 28, 2016 at 4:17:15 PM UTC-5, John H Palmieri wrote: >> >> When defining a category in Sage, is there any way to define >> "HomsetMethods" for that category? For example, if I want to have certain >> morphisms only defined when in an endomorphism set (so tab completion is >> less misleading), I would like to do: >> >> class MyCategory(Category_singleton): >> blah >> >> class Endset(CategoryWithAxiom): >> class HomsetMethods: >> def some_map(self): >> """ >> This is a map which should only exist in a set of >> endomorphisms. >> """ >> >> Is this possible? >> >> -- >> John >> >> -- 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.