quetion about "+=" and "runtime"

G

gagaguy

1.i saw "+=" in a program code,but i haven't see it before,neither can
i find it in a cook,who can tell me the usage of "python0"

2.how can i know how long does a program run?
 
T

Terry Reedy

1.i saw "+=" in a program code,but i haven't see it before,neither can
i find it in a cook,who can tell me the usage of "python0"

It probably is in the tutorial and certainly is in the reference manual.
I don't understand "usage of 'python0'".
2.how can i know how long does a program run?

time module

tjr
 
G

gagaguy

1.i have look " += " up,but i can't find it.is it ofthen used?
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
 
R

Robert Kern

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
(e-mail address removed)

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top