On Thu, Mar 19, 2015 at 4:52 AM, Peter Otten __pete...@web.de wrote:
Dave Angel wrote:
[...]
By the way, if you were to use a plain old loop the expected speedup over
the listcomp would be 2. You can break out of the loop when you have found
the gap, after iterating over one half of the list
On 03/23/2015 10:17 PM, Dave Angel wrote:
On 03/23/2015 09:42 PM, boB Stepp wrote:
Not really. See Steve's
OOPS. Peter's
response for some numbers. If I had to guess,
I'd say that for lists over 100 items, you should use bisect or
equivalent. But I'd also say you should have one
On Mon, Mar 23, 2015 at 08:42:23PM -0500, boB Stepp wrote:
On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel da...@davea.name wrote:
The catch to a list comprehension is it has to visit all the elements, while
a binary search would visit log-base-2 of them. So instead of 1
elements, you'd
On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel da...@davea.name wrote:
The catch to a list comprehension is it has to visit all the elements, while
a binary search would visit log-base-2 of them. So instead of 1
elements, you'd be searching about 14 items.
I suspected as much, but had not
On 03/23/2015 09:42 PM, boB Stepp wrote:
On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel da...@davea.name wrote:
The catch to a list comprehension is it has to visit all the elements, while
a binary search would visit log-base-2 of them. So instead of 1
elements, you'd be searching about 14
On Mon, Mar 23, 2015 at 10:17:11PM -0400, Dave Angel wrote:
On 03/23/2015 09:42 PM, boB Stepp wrote:
Can you give me a ballpark number for large, where this would start
making a meaningful difference?
Not really. See Steve's response for some numbers.
o_O
Have you borrowed Guido's Time
Patrick Thunstrom wrote:
The generalized problem:
L = [V0, V1, ..., Vn], where V0 = V1 = V2 = ... = Vn .
Find index i, such that V[i] = Vt = V[i + 1], where Vt is the test
value being searched for. I need to know the indices i and i + 1,
which I need to interpolate based on where Vt falls.
Dave Angel wrote:
On 03/19/2015 12:20 AM, boB Stepp wrote:
I hope extolling the beauty and power of Python on this list is
allowed, because I have had a large WOW!!! moment tonight. I had a
problem I was working on at work this afternoon. I have a list of ~
10,000 floating point numbers,
The generalized problem:
L = [V0, V1, ..., Vn], where V0 = V1 = V2 = ... = Vn .
Find index i, such that V[i] = Vt = V[i + 1], where Vt is the test
value being searched for. I need to know the indices i and i + 1,
which I need to interpolate based on where Vt falls.
The solution (As a
On 19/03/2015 04:20, boB Stepp wrote:
I hope extolling the beauty and power of Python on this list is
allowed, because I have had a large WOW!!! moment tonight. I had a
problem I was working on at work this afternoon. I have a list of ~
10,000 floating point numbers, which run from largest to
I hope extolling the beauty and power of Python on this list is
allowed, because I have had a large WOW!!! moment tonight. I had a
problem I was working on at work this afternoon. I have a list of ~
10,000 floating point numbers, which run from largest to smallest.
There are duplicates scattered
On 03/19/2015 12:20 AM, boB Stepp wrote:
I hope extolling the beauty and power of Python on this list is
allowed, because I have had a large WOW!!! moment tonight. I had a
problem I was working on at work this afternoon. I have a list of ~
10,000 floating point numbers, which run from largest to
12 matches
Mail list logo