[Tutor] List comprehension question
steve at pearwood.info
Fri Nov 12 06:07:03 CET 2010
Richard D. Moores wrote:
> On Wed, Nov 10, 2010 at 01:30, Steven D'Aprano <steve at pearwood.info> wrote:
>> P.S. don't take that as a put down -- you should be pleased that your code is around as fast as Tim Peter's code :)
> Nah. But where is Tim Peter's code?
The timeit module was written by Tim Peters. Since then, others have
contributed as well, but the basic recipe is his.
For those who don't know, Tim Peters, a.k.a. the timbot, is one of the
old-time Python demigods. He is responsible for not one, but two,
awesomely fast sort routines: the original list.sort() method was his,
and then around Python 2.3 (I think) he re-wrote it using a new sort
method which is even faster, added stability, and has fewer special
cases than the previous version. This sort algorithm has since been
adopted by Android and Java 7.
More information about the Tutor