Add a "key" parameter to bisect* functions?

Giacomo Alzetta giacomo.alzetta at gmail.com
Wed Sep 12 12:22:12 EDT 2012


Il giorno mercoledì 12 settembre 2012 18:05:10 UTC+2, Miki Tebeka ha scritto:
> > I've just noticed that the bisect module lacks of the key parameter.
> 
> > ...
> 
> > Is there some reason behind this lack?
> 
> See full discussion at http://bugs.python.org/issue4356. Guido said it's going in, however there's no time frame for it.

Oh, nice. So eventually it'll be added.

Correct me if I'm wrong, but the reason for this absence is that people could think that doing repeated bisects using keys would be fast, even though keys has to be recomputed?

I think that could simply be fixed with a "Note:\Warning:" on the documentation.
So that you can create keys with caching or use precomputed keys when you have to do a lot of bisects.



More information about the Python-list mailing list