A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-May/004089.html below:

[Python-Dev] join() et al.

[Python-Dev] join() et al.Skip Montanaro skip@mojam.com (Skip Montanaro)
Tue, 16 May 2000 09:52:59 -0500 (CDT)
    >> Alternatively, there has been talk about moving join() into the
    >> built-ins, but I'm not sure if the semantics of tha have been nailed
    >> down.

    Marc> This is probably the way to go. Semantics should probably
    Marc> be:

    Marc> 	join(seq,sep) := reduce(lambda x,y: x + sep + y, seq)

    Marc> and should work with any type providing addition or concat slot
    Marc> methods.

Of course, while it will always yield what you ask for, it might not always
yield what you expect:

    >>> seq = [1,2,3]
    >>> sep = 5
    >>> reduce(lambda x,y: x + sep + y, seq)
    16

;-)

-- 
Skip Montanaro, skip@mojam.com, http://www.mojam.com/, http://www.musi-cal.com/
"We have become ... the stewards of life's continuity on earth.  We did not
ask for this role...  We may not be suited to it, but here we are."
- Stephen Jay Gould



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