> The sum function starts off with the integer 0, so it tries to add one > of your objects to the integer 0. This is probably what's going > wrong. You can pass as a second argument the thing you want sum to > start with. For example,
thanks ! much to my shame, i recall now that i was given this explanation a long time ago, and forgot about it. In case anyone is reading this: the quickest fix seems to add a __radd__(self, wrongtype) method that just returns self. Works fine (kind of dangerous sometimes of course...) > You need to define the __repr__ method, since that is what list is > using to display your objects. ah. I try to avoid using __repr__ because i was told that this is supposed to return a string from which the object can be reconstructed -- and i certainly don't want to go through all that trouble just for what i need. Do you know what happens if __repr__ simply returns the same as __str__ ? thanks again! pierre --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
