Tim Peters wrote: > I can't say it bothers me to specify an appropriate identity element > when 0 is inappropriate. Maybe instead of a single sum() function, each summable type should have a sum() static method which uses an identity appropriate to that type. So to sum a list of integers you would use int.sum(x), to sum floats you would use float.sum(x), and to sum timedeltas you would use timedelta.sum(x). This would also neatly solve the problem of people trying to sum strings, because there would be no str.sum() method. Or alternatively, there could be a str.sum(x) which was equivalent to "".join(x). Although it might be better to call it str.concat() instead of str.sum(). -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg.ewing at canterbury.ac.nz +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4