Re: why not bisect options?
- From: castironpi@xxxxxxxxx
- Date: Fri, 29 Feb 2008 13:36:06 -0800 (PST)
On Feb 29, 1:15 pm, Raymond Hettinger <pyt...@xxxxxxx> 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.
.
- References:
- why not bisect options?
- From: Robert Bossy
- Re: why not bisect options?
- From: Raymond Hettinger
- why not bisect options?
- Prev by Date: Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'
- Next by Date: Re: How about adding rational fraction to Python?
- Previous by thread: Re: why not bisect options?
- Next by thread: joining strings question
- Index(es):
Relevant Pages
|