Hi Andrew,

On 2014-05-28, R. Andrew Ohana <andrew.oh...@gmail.com> wrote:
> For instance, what is the recommended class I should inherit from for my
> parent class? I see at the top of sage.rings.rings, that it is not
> recommended that I inherit from the Ring class anymore (maybe?),

REALLY? Why is that?

Personally, I would not hesitate to use these existing base classes
(sage.rings.ring.Ring for example) for things that are guaranteed to be
rings. Of course, if the actual algebraic structure depends on
parameters, then one must use a more basic base class.

That said, it is certainly suspicious that sage.rings.ring.Ring inherits
from sage.structure.parent_old(!).Parent. But this also inherits from
sage.structure.parent.Parent, and all should be good.

Similarly for elements. I'd say, if there is a suitable cythoned base
class, then use it.

By the way, this is what I recommended in the thematic tutorial on
categories and coercion.

> but should use the category framework.

This should certainly be done, too. Personally, I'd not like to let the
category framework do all the work. After all, it is mainly written in
Python, whereas the old base classes are written in Cython. I suppose
this will matter when it comes to speed.

> In which case, what should I inherit from?
> Parent directly?

This is a possibility.

> If I was looking to add a group, there is no such warning
> in sage.groups.groups, so should I inherit from Group in that case?

This is another possibility. To me, it seems that
sage.groups.group.Group just provides a couple of placeholder methods
(is_abelian and so on).

OMG, I just see that sage.groups.group.Group.__contains__ overrides
sage.structure.parent.Parent.__contains__ in a very bad way!! Ouch, that
is not nice. So, after seeing this, I'd say I would stick with
sage.structure.parent.Parent in this case, and as soon as I have time
I will open a ticket to remove the __contains__.

> Same goes for my elements, what is the correct base class to use?

In the case of elements, I would tend more clearly towards using cythoned
base classes than in the case of parents. After all, Parents are containers,
while elements do the actual work and thus need speed.

> Moreover, the two frameworks documentation don't really mention anything
> about each other, or how they interact. From my understanding, they were
> built up independently, so it would make some sense if they don't interact.

I believe that I explain in the thematic tutorial on categories and
coercion how they interact.

Best regards,
Simon


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

Reply via email to