iteration without storing a variable

Josh Dukes josh.dukes at microvu.com
Wed Mar 25 20:28:00 CET 2009


well if we're interested in that...

$ uname -a
Linux IT2-JD 2.6.27-gentoo-r8 #1 SMP Tue Mar 17 14:28:19 PDT 2009 x86_64 Intel(R) Pentium(R) D CPU 2.80GHz GenuineIntel GNU/Linux

$ python --version
Python 2.5.2

$ ruby --version
ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]

but I was more talking about the speed differences between ruby and python.

On Wed, 25 Mar 2009 20:13:13 +0100
Stefan Behnel <stefan_ml at behnel.de> wrote:

> Josh Dukes wrote:
> > $ time python -c 'a = "A";
> > for r in xrange(100000): a += "A" '
> > 
> > real	0m0.109s
> > user	0m0.100s
> > sys	0m0.010s
> > 
> > Anyone get different results? 
> 
> Sure:
> 
> $ time python -c 'a = "A";
> for r in xrange(100000): a += "A" '
> 
> real    0m0.140s
> user    0m0.132s
> sys     0m0.008s
> 
> 
> Stefan
> 
> 
> (BTW, this is using Python 2.5.2 on Ubuntu Linux etc.pp., but no-one's
> interested in these details anyway, right?)
> --
> http://mail.python.org/mailman/listinfo/python-list


-- 

Josh Dukes
MicroVu IT Department



More information about the Python-list mailing list