Function to merge sorted lists

John Goerzen jgoerzen at complete.org
Thu Sep 6 17:48:31 EDT 2001


"Matthew D. Wood" <woodm at equire.com> writes:

> Would it be faster to use the list.pop command?  I doubt it, but then
> again, I'm always surprised.

I thought about that first, but then that modifies the input and
wouldn't work with tuples.

You can modify the return line to:

    return ret + list(l2[l2c:])

and tuples will be supported as well.

-- John




More information about the Python-list mailing list