On Tue, Dec 29, 2009 at 12:28:46PM +0000, John Cremona wrote: > 2009/12/29 Nathann Cohen <nathann.co...@gmail.com>: > > Excellent ! Then > > > > __builtin__.sum([g,h],Graph()) > > > > does the job.. Thank you :-)
Just 2 cents: in our code, we systematically use the following feature from additive monoids: sage: M = CommutativeAdditiveMonoids().example() sage: M An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd') sage: a,b,c,d = M.additive_semigroup_generators() sage: M.sum([a,b,c]) a + c + b The advantage compared to using a coercion 0 -> M is that: sage: M.sum([]).parent() is M True In this spirit, maybe we could have Graph.sum([g,h]). Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- 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