Function to show time to execute another function

Cecil Westerhof Cecil at decebal.nl
Sun Jun 7 07:53:18 EDT 2015


On Sunday  7 Jun 2015 11:06 CEST, Luca Menegotto wrote:

> Il 07/06/2015 10:22, Cecil Westerhof ha scritto:
>> That only times the function. I explicitly mentioned I want both
>> the needed time AND the output.
>>
>> Sadly the quality of the answers on this list is going down....
>
> First of all, thank God it's a newsgroup, not a list.

My bad.


> Second, often the quality of an answer is deeply connected to the
> quality of a question. I've red your question, and I still have not
> clear what you want.

Well, it was not a question, it was sharing. I wanted something that
showed the needed time, but also the result. It was not a piece of
art, but something I thought could be useful to share.


> If you want a function that returns a result and a time elapsed, why
> don't you pack the time and the result in a tuple, a list or a
> dictionary? it takes 20 seconds, if you are slow.

I already did that. Sort of. I made a version that defaults to
printing the needed time and returning the result, but can me made to
put the time in a tuple with the result.

I must be very slow. :'-( It took more as 20 seconds.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list