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 design (successive calls to 
bisect functions would not "remember" all of the previous key lookups).

Instead, it is better to search a list of precomputed keys to find the index of 
the record in question...


Is that right that the documentation encourages to use O(N) algorithm [by 
making a copy of all keys] instead of using O(log(N)) bisect with 
kay=attrgetter?  And claims that O(N) is more efficient than O(log(N))?  

Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to