A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/307668.html below:

Feature Proposal: Sequence .join method

Feature Proposal: Sequence .join methodDavid Murmann david.murmann at rwth-aachen.de
Thu Sep 29 23:33:34 EDT 2005
> def join(sep, seq):
>     return reduce(lambda x, y: x + sep + y, seq, type(sep)())

damn, i wanted too much. Proper implementation:

def join(sep, seq):
     if len(seq):
         return reduce(lambda x, y: x + sep + y, seq)
     return type(sep)()

but still short enough

see you,
David.

More information about the Python-list mailing list

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