On Fri, 11 Jun 1999, Skip Montanaro wrote: > It occurred to me just a few minutes after sending my previous message that > it might make sense to make string.join a method for lists and tuples. > They'd obviously have to make the same type checks that string.join does. as in: >>> ['spam!', 'eggs!'].join() 'spam! eggs!' ? I like the notion, but I think it would naturally migrate towards genericity, at which point it might be called "reduce", so that: >>> ['spam!', 'eggs!'].reduce() 'spam!eggs!' >>> ['spam!', 'eggs!'].reduce(' ') 'spam! eggs!' >>> [1,2,3].reduce() 6 # 1 + 2 + 3 >>> [1,2,3].reduce(10) 26 # 1 + 10 + 2 + 10 + 3 note that string.join(foo) == foo.reduce(' ') and string.join(foo, '') == foo.reduce() --david
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