I Kt just occurred to me: Even though l.sort() is sorting a presorted array, it still must be doing 10000-1 RichCompares minimum, just like max. So how do we explain the large difference? > -----Original Message----- > From: python-dev-bounces+kristjan=ccpgames.com at python.org > [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf > Of Antoine Pitrou > Sent: Wednesday, October 22, 2008 14:06 > To: python-dev at python.org > Subject: Re: [Python-Dev] heapq, min and max > > Kristján Valur Jónsson <kristjan <at> ccpgames.com> writes: > > timeit.Timer("(l.sort(), l[-1])", > > s).timeit(1000) > > > > 0.29406761513791935 > > This is clearly wrong. l.sort() will sort the list in place when it is > first > invoked, and therefore will be very fast in subsequent calls. >
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