On Monday, August 1, 2016 at 2:19:32 AM UTC-7, Nicolas M. Thiéry wrote:
>
>        Hi John, 
>
> On Thu, Jul 28, 2016 at 02:17:15PM -0700, 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? 
>
> If you want to implement methods that apply to all morphisms in all 
> subcategories, you can do: 
>
>         class MyCategory(Category_singleton): 
>             class MorphismMethods: 
>                  def f(x): ... 
>
> If you want to implement methods that apply to all endomorphisms in 
> all *full* subcategories (literally: elements of some homset in 
> MyCategory that is a endset): 
>
>         class MyCategory(Category_singleton): 
>             class Homsets(HomsetsCategory): 
>                  class EndSet(CategoryWithAxiom): 
>                       class ElementMethods: 
>                           def f(x): ... 
>

Good, this approach does what I want. Thank you.
 

>
> At this stage, I don't see a way to provide a method in all 
> subcategories, but only for endomorphisms. How important is this use 
> case? 
>

I don't need that for my case.

-- John


> It's annoying to have to create the Homsets class above, if the only 
> thing there is inside is about Endset. Maybe we could have a Endsets 
> shortcut. 
>
> Sorry, this is all a bit complicated. Some of it is because the math 
> behind is not trivial: no free lunch. But it maybe as well that we 
> haven't yet accumulated enough experience with support for homsets / 
> morphisms to get to the right design. Ideas welcome! 
>
> Ah, just in case this helps reducing the number of experiments: as its 
> name suggests, XXXMethods never contains anything else than methods 
> (and possibly constants). 
>
> Cheers, 
>                                 Nicolas 
> -- 
> Nicolas M. Thiéry "Isil" <nth...@users.sf.net <javascript:>> 
> http://Nicolas.Thiery.name/ 
>

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

Reply via email to