Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!news.panservice.it!feed.xsnews.nl!border02.ams.xsnews.nl!feeder02.ams.xsnews.nl!abp002.ams.xsnews.nl!frontend-F09-07.ams.news.kpn.nl From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Re: Function to show time to execute another function Organization: Decebal Computing References: <87k2vgowco.fsf@Equus.decebal.nl> <87fv64orly.fsf@Equus.decebal.nl> X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E X-Homepage: http://www.decebal.nl/ Date: Sun, 07 Jun 2015 13:53:18 +0200 Message-ID: <877frfpwep.fsf@Equus.decebal.nl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:UROppAR/8rHhinYnbIEU1lrzqCI= MIME-Version: 1.0 Content-Type: text/plain Lines: 36 NNTP-Posting-Host: 81.207.62.244 X-Trace: 1433678452 news.kpn.nl 21059 81.207.62.244@kpn/81.207.62.244:53306 Xref: csiph.com comp.lang.python:92238 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