Hi Nils! On Fri, Nov 09, 2012 at 08:44:15AM -0800, Nils Bruin wrote: > On Nov 9, 2:11 am, "Nicolas M. Thiery" <nicolas.thi...@u-psud.fr> > wrote: > > The main point is that writing V.sum(args) gives more information to > > the system than sum(args, self.zero()): this is making a promise that > > all elements in args are elements of V. > > In python's call dispatch system, it does not. It says something along > the lines: "Use V" to add up these arguments.
Yes, that's what I mean by ``giving more information'': V has the required information to do it fast, so use it. > I guess the convention could be that if someone calls this, then > they should make sure that "args" only involves elements from V. This is indeed the intended precondition, as stated in the documentation of CommutativeAdditiveMonoids.ParentMethods.sum: - ``args`` -- a list (or iterable) of elements of ``self`` Granted: ``element of`` is a bit vague. The exact intention is that ``self.is_parent_of(x)`` holds for all x in the sum. > But then V.sum(W) would not be valid in interesting cases either > (apart from probably not being a finite operation). If such a feature is desired at some point, then I would want it to be implemented in a different method. Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.