On 04/09/2012 03:54, Roy Smith wrote:
Let's assume you're testing two strings for equality. You've already
done the obvious quick tests (i.e they're the same length), and you're
down to the O(n) part of comparing every character.
I'm wondering if it might be faster to start at the ends of the s
On 10/09/2012 18:33, Oscar Benjamin wrote:
Computing the hash always requires iterating over all characters in the string
so is best case O(N) where string comparison is best case (and often average
case) O(1).
Yep, but you already have O(N) costs just creating the strings in the
first place,
On 10/09/2012 18:07, Dan Goodman wrote:
On 04/09/2012 03:54, Roy Smith wrote:
Let's assume you're testing two strings for equality. You've already
done the obvious quick tests (i.e they're the same length), and you're
down to the O(n) part of comparing every charac
Hi all,
Until recently, our package has been pure Python, so distributing it has
been straightforward. Now, however, we want to add some extension
modules in C++. We're happy to provide source only distributions on
Linux because almost all Linux users will have all the required
compilers and
Hi,
On 26/04/2011 15:40, Mihai Badoiu wrote:
> I have terrible performance for multiplication when one number gets very
> close to zero. I'm using cython by writing the following code:
This might be an issue with denormal numbers:
http://en.wikipedia.org/wiki/Denormal_number
I don't know much
Chris Angelico gmail.com> writes:
> I'm working with the ast module to do some analysis on Python
> codebases, and once I've found what I'm looking for, I want to print
> something out. The file name I'm hanging onto externally, so that
> works; and the nodes all have a lineno. So far so good. But
Takes less than 1 sec here to do (10**100)**(1./13) a million times, and
only about half as long to do (1e100)**(1./13), or about 14 times as
long as to do .2**2. Doesn't look like one could hope for it to be that
much quicker as you need 9 sig figs of accuracy to get the integer part
of (10**1
Mark Dickinson wrote:
I'd also be a bit worried about accuracy. Is it important to you
that the
integer part of the result is *exactly* right, or is it okay if
(n**13)**(1./13) sometimes comes out as slightly less than n, or if
(n**13-1)**(1./13) sometimes comes out as n?
I don't think accura
Mark Dickinson wrote:
Well, random numbers is one thing. But how about the following:
n = 12345**13
n
154662214940914131102165197707101295849230845947265625L
int(n ** (1./13)) # should be 12345; okay
12345
int((n-1) ** (1./13)) # should be 12344; oops!
12345
Good point! Oops indeed. :
This sounds kind of similar to a problem I posted to this list last
year, you might find that thread gives you some ideas:
http://mail.python.org/pipermail/python-list/2008-January/474071.html
Dan
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
Here's my solution (I haven't bothered with making it efficient, BTW):
import operator
def solve(n):
best_len = n
best_expr = ""
for x in range(1, n - 2):
for y in range(x, n):
for op, name in operator_list:
# Does this pair with this
eric.le.bi...@spectro.jussieu.fr wrote:
Hello,
Is there a way to easily build an object that behaves exactly like a
float, but whose value can be changed? The goal is to maintain a list
[x, y,…] of these float-like objects, and to modify their value on the
fly (with something like x.value = 3.1
eric.le.bi...@spectro.jussieu.fr wrote:
I initially tried to create a Float_ref class that inherits from
numpy.array, so that objects of the new class behave like numpy.array
in calculations, but also contain an "uncertainty" atribute, but this
is apparently not allowed ("cannot create 'builtin_f
Hi all,
I'm doing some C++ code generation using Python, and would be interested
in any comments on the approach I'm taking.
Basically, the problem involves doing some nested loops and executing
relatively simple arithmetic code snippets, like:
for i in xrange(len(X)):
X[i] += 5
Actually
hey appear in the .tar.gz file (i.e. execute bit not
set), but I'm not sure if these values are meaningful because they
probably don't correspond to any underlying values in the Win 7 file system.
Any help much appreciated!
Thanks,
Dan Goodman
--
http://mail.python.org/mailman/listinfo/python-list
I tried a very similar thing, but not using with statements:
http://mail.python.org/pipermail/python-list/2010-March/1239577.html
Dan
On 04/05/2010 22:36, Terry Reedy wrote:
In a current thread, people have claimed that generating properly
indented nested blocks is a pain because of the need t
On 10/07/2010 22:08, Neal Becker wrote:
Sumatra looks like an interesting project
http://pypi.python.org/pypi/Sumatra/0.2
But I have some questions. Is there any mail list or forum? I can't find
anything on the website.
It's part of Neural Ensemble which has a google group (not specifically
17 matches
Mail list logo