On Mon, Nov 23, 2015 at 8:24 AM, Eric Gourgoulhon <egourgoul...@gmail.com>
wrote:

> Hi,
>
> Le lundi 23 novembre 2015 10:55:40 UTC+1, Jeroen Demeyer a écrit :
>>
>>  Of course, you could argue that Element
>> should not have __add__ and __mul__ (since not all elements can be added
>> or multiplied). But it doesn't really hurt to have them and raise
>> NotImplementedError (unless I'm missing something).
>>
>>
> Maybe a too naive remark: what you propose seems against standard
> object-oriented programming. Isn't it more clear to have a generic base
> class Element and implement __add__ and __mul__ only in derived classes,
> when relevant? Sorry, I don't know the details of the element classes, so
> you may have good reasons to do this...
>

The reason is that most of what would go in the intermediate classes
(RingElement, ModuleElement, etc) should go on the categories instead.
Right now there's a bunch of intermediate classes that don't do much, and
in fact encourage bad programming (since someone might test
isinstance(RingElement) not knowing that not all ring elements inherit from
it).

I agree with flattening the structure and just having Element.  We should
also get rid of parent_old.Parent....
David


>
> Best wishes,
>
> Eric.
>
> --
> 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.
>

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