quetion about "+=" and "runtime"

Robert Kern rkern at ucsd.edu
Thu Aug 4 00:17:01 EDT 2005


gagaguy at gmail.com wrote:
> 1.i have look " += " up,but i can't find it.

http://docs.python.org/ref/augassign.html

> is it ofthen used?

Reasonably so.

> 2.i saq a result like this in a web page:
> 
> 
> $ time python permute2.py 56789 3
> Got 120 items.
> Maximum at 87596 ,product 84000
> 
> real    0m0.057s
> user    0m0.050s
> sys     0m0.000s
> 
> $ time python permute3.py 56789 3
> Got 120 items.
> Maximum at 87596 ,product 84000
> 
> real    0m0.040s
> user    0m0.030s 
> sys     0m0.010s 
> 
> i wanna know how to call out this

As Terry said, look at the "time" module. Don't use the "time" program 
(a standard program on UNIX-like systems) unless you actually want to 
time the startup of the interpreter too rather than just the code itself.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list