[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: why not bisect options?
From: castironpi () gmail ! com
Date: 2008-02-29 21:36:06
Message-ID: 5d8896de-0725-4a70-95e1-9f9eb4c128ff () x41g2000hsb ! googlegroups ! com
[Download RAW message or body]
On Feb 29, 1:15 pm, Raymond Hettinger <pyt...@rcn.com> wrote:
> [Robert Bossy]
>
> > I thought it would be useful if insort and consorts* could accept the
> > same options than list.sort, especially key and cmp.
>
> If you're going to do many insertions or searches, wouldn't it be
> *much* more efficient to store your keys in a separate array?
>
> The sort() function guarantees that it calls the key function exactly
> once for each member of the list. With and bisect/insort, successive
> searches can call the key function over and over again with the same
> value.
>
> Raymond
Since sort time is at least linear, sort ( key, obj ) pairs; return
obj's.
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic