I am actually using a activestate wrapper for calculating execution time of my 
program.

This is the code 
#!/usr/bin/python# A simple wrapper for the timeit module.import timeit
def Timeit(func,number=10000,module="__main__"):    """ A wrapper which can    
be used to time any function """
    name = func.__name__    t = timeit.Timer("%s()"%name, "from %s import %s" % 
(module, name))    return "%.2f usec/pass" % 
(1000000*t.timeit(number=number)/number)
if __name__=="__main__":
    from program import*
    # Using wrapper    print Timeit(main)    # Directly using timeit    t = 
timeit.Timer("main()", "from __main__ import main")    print "%.2f usec/pass" % 
(1000000*t.timeit(number=10000)/10000)

So, this module is showing my execution time in usec/pass.
I tested it for a puzzle and that showed me around 1385.33 usec/sec..However, 
as its from facebook hackers cup where I got a penalty time of 28.32.00 (not 
exactly, forgot).. 
what units facebook was following.. If I had to change those usec/pass units to 
seconds, what I have to use.
can anyone tell me?


                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to