better 'splice' function

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Jul 17 10:59:44 EDT 2002


On 17-Jul-2002 gyromagnetic wrote:
> Hi,
> I have written a function that essentially 'splices' together a number
> of tuples in a list, and I would appreciate any suggestions that you
> might have on how to make the code or algorithm better.
> 
> Each tuple in the input list comprises three strings, e.g.
> ('A','k1,'B').
> The splice function should exhaustively try to match the 'end' (last
> element) of one tuple with the 'beginning' (first element) of another
> (eliminating the duplicate string) to create the longest tuples
> possible.
> 

something A LOT like this was discussed within the last two months at length. 
Many, many, many implementations were presented.  Have a search through the
archives.





More information about the Python-list mailing list