On 11/13/10 12:38 PM, Tom Boothby wrote:
I agree, John.  It would be better to define a .sum() method on the
generic vector class, which calls the global sum().  Then, it'll be
overridden by various classes which can do it faster.


If we're now making a convention for the global sum function (i.e., try calling the .sum() method first), I'm curious how many other objects have a .sum() method? Will this break things? This question not only holds for Sage stuff, but for any library out there. Since we are talking about changing the behavior of a standard python function (sum), I can see a lot of confusion if sum(object) starts behaving differently because object happens to have an object.sum() method.

For that reason, I think the magic method that sum() tries should be something more obscure, like ._sum_sage() or something like that. Then it would be much more unlikely to mess up objects out there that happened to have .sum() methods.

Thanks,

Jason

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