Hi Alex,

On 2012-03-24, AlexGhitza <aghi...@gmail.com> wrote:
> ------=_Part_614_22458373.1332555347386
> Content-Type: text/plain; charset=ISO-8859-1
> Schemes and their points are not yet properly embedded in the category
> framework.

Yes. In one of my patches on categories, I ran into it and found it
impossible to get Schemes to work in that regard. I mean, how to create
a morphism, for example. It ought to be possible to create morphisms if
you want to put things into a category!

> In the latter case (elements of QQ), things are set up so that Sage
> knows that Rational is a subtype of QuotientFields.element_class.  But
> for schemes, Sage does not know that SchemeMorphism_point_affine is a
> subtype of Schemes_abstract.HomCategory.element_class.  So how do I fix
> this?  I have tried to locate how this is done for QQ, but I haven't
> succeeded.  Can anyone point me to this?

Have you had a look at my worksheet/tutorial on it? See
http://sagenb.org/home/pub/3837/

As Nicolas has pointed out, the most important thing is that the category
of the parent is defined during its initialisation. In sage-5.0, most
algebraic parent structures *will* use categories (e.g., all rings).

In order to make an element of P inherit methods from
P.category().element_class, it actually suffices to initialise the
category of P. However, in that case, access to these additional methods
may be a bit slow, because some custom __getattr__ method is used.

However, if you provide P with an attribute "Element", then P will
automatically provided with an attribute P.element_class -- and this
element class can access the additional methods by class inheritance,
which is of course faster than a custom __getattr__ method.

Best regards,
Simon


-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to