beceuse they don't expect the container to ever become large.
On Friday, March 6, 2015 at 6:24:24 PM UTC-8, Steven D'Aprano wrote:
> Dmitry Chichkov wrote:
>
> > I was looking over documentation of the bisect module and encountered the
> > following very strange statemen
I was looking over documentation of the bisect module and encountered the
following very strange statement there:
>From https://docs.python.org/2/library/bisect.html
...it does not make sense for the bisect() functions to have key or reversed
arguments because that would lead to an inefficient
wrote:
> On 9/1/2010 9:08 PM, Dmitry Chichkov wrote:
>
>
> Your problem is underspecified;-).
> Detailed timing comparisons are only valid for a particular Python
> version running under a particular OS on particular hardware. So, to
> actually run a contest, you would have to
By the way, improving n-ARG-smallest (that returns indexes as well as
values) is actually more desirable than just regular n-smallest:
== Result ==
1.38639092445 nargsmallest
3.1569879055 nargsmallest_numpy_argsort
1.29344892502 nargsmallest_numpy_argmin
Note that numpy array constructor eats aro
Uh. I'm sorry about the confusion. Last three items are just O(N)
baselines. Python min(), Numpy argmin(), Numpy asarray().
I'll update the code. Thanks!
> A lot of the following doesn't run or returns incorrect results.
> To give but one example:
>
> > def nargsmallest_numpy_argmin(iter, k):
> >
Given: a large list (10,000,000) of floating point numbers;
Task: fastest python code that finds k (small, e.g. 10) smallest
items, preferably with item indexes;
Limitations: in python, using only standard libraries (numpy & scipy
is Ok);
I've tried several methods. With N = 10,000,000, K = 10 The