Hi Travis! On Thu, Apr 10, 2014 at 11:49:44AM -0700, Travis Scrimshaw wrote: > Suppose I have a homset H from X to Y, and now suppose I have two > classes for the morphisms Phi, Psi which I want to choose between > depending on the input to H.__call__(). I know the proper (I believe > fastest?) way to do things is to set H.Element to the generic class so > that we construct H.element_class which inherits properties from the > corresponding category. It currently works if I just returning the correct > class and passing the parent, but is this the best way to do things? I > don't want to have to combine Phi and Psi into a common class for speed, > but I can do so.
That's definitely a situation that we will encounter more and more, especially with morphisms. A natural thing to try would be to have two lazy attributes, say H.element_class_Phi and H.element_class_Psi, that would be built using __make_element_class__ (it was meant from the beginning for this use case). And then have _element_constructor_ call one class or the other. This has not been explored much yet, so the best idiom is yet to be found. You are a good candidate for this exploration :-) 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-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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.