iteration without storing a variable
Stefan Behnel
stefan_ml at behnel.de
Wed Mar 25 15:13:13 EDT 2009
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?)
More information about the Python-list
mailing list