What is the best way to join tuples?

Raymond Hettinger vze4rx4y at verizon.net
Fri Nov 15 05:17:49 EST 2002


"dique" <chezdique at yahoo.com> wrote in message
news:3dd46d0b_1 at news.tm.net.my...
> Thanx Raymond and Terry! Both of you have great solutions.Work like a
charm!
> I wonder which is more efficient :p

The dictionary approach is fastest at O(n).
The list.sort() approach is no slouch at O(n log n).
The nested loop method is the slowest at O(n**2).

The list.sort() and nested loop methods take the
least space.  Dictionaries consume the most space.


Raymond Hettinger






More information about the Python-list mailing list