> My preference would be to limit sum() to value addition only, and never do 
> concatenation.

I would be happy with that, provided there was join function and operator:

     >>> join = lambda x: reduce(lambda y, z: y.__join__(z), x)

I think this is clearer than sum():

     >>> join(['a', 'b', 'c'])
     'abc'

It wouldn't interfere with ''.join(), and ''.__add__() could be 
redirected to ''.__join__().

> For all non numeric types it would generate an exception.

How about generating an exception where __add__ isn't defined, so it 
would work on MyFunkyVector type.  I could join my vectors together as 
well, since in MyNonEucledeanSpace, it doesn't mean the same thing as "add".


Joel

_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to