On Dec 17, 8:01 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 17 Dec 2007 01:53:24 -0300, <[EMAIL PROTECTED]> escribió:
>
> > On Dec 16, 8:47 pm, [EMAIL PROTECTED] wrote:
> >>ncalls tottime percall cumtime percall filename:lineno(function)
> >> 577656.0200.000 1
On Dec 16, 8:47 pm, [EMAIL PROTECTED] wrote:
>ncalls tottime percall cumtime percall filename:lineno(function)
> 577656.0200.000 12.9700.000
> /usr/lib64/python2.4/_strptime.py:273(strptime)
> ...
actually, the C-version of strptime() is also getting called:
57765
It looks like there are two implementation of strptime() (why?) and
the one that's used by default is the Python version in _strptime.py
Unfortunately, it's pretty slow and takes up a big chunk of my code's
execution time. Is there a way to use the C version instead (is there
a C version in time.s
Hi folks,
Thanks, for all the help. I tried running the various options, and
here is what I found:
from array import array
from time import time
def f1(recs, cols):
for r in recs:
for i,v in enumerate(r):
cols[i].append(v)
def f2(recs, cols):
for r in recs:
Given a bunch of arrays, if I want to create tuples, there is
zip(arrays). What if I want to do the opposite: break a tuple up and
append the values to given arrays:
map(append, arrays, tupl)
except there is no unbound append() (List.append() does not exist,
right?).
Without append(), I am forc
On Dec 13, 1:23 pm, Jakub Stolarski <[EMAIL PROTECTED]> wrote:
> If all you need is the result here's simpler and more efficient code:
>
> from random import randrange
> sum = 100 * randrange(128)
> print "Sum is ", sum
>
> And the same in perl:
>
> my $sum = 100 * int(rand(128));
> print "Sum is $
First, let me admit that the test is pretty dumb (someone else
suggested it :) but since I am new to Python, I am using it to learn
how to write efficient code.
my $sum = 0;
foreach (1..10) {
my $str = chr(rand(128)) x 1024;
foreach (1..100) {
my $substr = substr($str, rand(900
On Dec 12, 4:03 pm, John Machin <[EMAIL PROTECTED]> wrote:
> Inside your function
> [you are doing all this inside a function, not at global level in a
> script, aren't you?], do this:
> from time import mktime, strptime # do this ONCE
> ...
> blahblah = int(mktime(strptime(s, "%m%d%y%H
Hi, I am pretty new to Python and trying to use it for a relatively
simple problem of loading a 5 million line text file and converting it
into a few binary files. The text file has a fixed format (like a
punchcard). The columns contain integer, real, and date values. The
output files are the same