Re: Function to show time to execute another function

2015-06-08 Thread Cecil Westerhof
On Monday 8 Jun 2015 07:04 CEST, Johannes Bauer wrote: On 07.06.2015 22:35, Cecil Westerhof wrote: And you also posted your solution. I fail to find any question in your original posting at all. That is because there was no question: I just wanted to share something I thought that could

Re: Function to show time to execute another function

2015-06-07 Thread Johannes Bauer
On 07.06.2015 10:22, Cecil Westerhof wrote: That only times the function. I explicitly mentioned I want both the needed time AND the output. And you also posted your solution. I fail to find any question in your original posting at all. Sadly the quality of the answers on this list is going

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
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

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 20:51 CEST, Johannes Bauer wrote: On 07.06.2015 10:22, Cecil Westerhof wrote: That only times the function. I explicitly mentioned I want both the needed time AND the output. And you also posted your solution. I fail to find any question in your original posting at

Re: [OT] Re: Function to show time to execute another function

2015-06-07 Thread Mark Lawrence
On 07/06/2015 12:02, Marko Rauhamaa wrote: Mark Lawrence breamore...@yahoo.co.uk: Get your cheque book and go for paid support. Are checks still in use in Britain? I thought only Americans still did that. Marko Cheques are still in use in Britain. There was a move a year or so ago to

Re: Function to show time to execute another function

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 08:16 pm, Mark Lawrence wrote: I suggest that you stop asking so many question here. Get your cheque book and go for paid support. Mark, that remark is uncalled for and completely out of line. Cecil is perfectly entitled to ask questions here, and you are entitled to

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 12:16 CEST, Mark Lawrence wrote: I suggest that you stop asking so many question here. Get your cheque book and go for paid support. First of all: it was not a question: I shared something I thought was useful. You can disagree about it being useful, but there is in my

Re: Function to show time to execute another function

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function, *args): startTime = time.time()

Re: Function to show time to execute another function

2015-06-07 Thread Laura Creighton
In a message of Sun, 07 Jun 2015 11:16:30 +0100, Mark Lawrence writes: I suggest that you stop asking so many question here. Get your cheque book and go for paid support. Knock this off, please. Some of us dearly like to teach people who want to explore and learn things. Laura --

Re: Function to show time to execute another function

2015-06-07 Thread Tim Golden
On 07/06/2015 11:16, Mark Lawrence wrote: On 07/06/2015 09:22, Cecil Westerhof wrote: 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. Here I get an alternative that does only half what

[OT] Re: Function to show time to execute another function

2015-06-07 Thread Marko Rauhamaa
Mark Lawrence breamore...@yahoo.co.uk: Get your cheque book and go for paid support. Are checks still in use in Britain? I thought only Americans still did that. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:28 CEST, Steven D'Aprano wrote: On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 13:05 CEST, Tim Golden wrote: On 07/06/2015 11:16, Mark Lawrence wrote: On 07/06/2015 09:22, Cecil Westerhof wrote: 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

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:28 CEST, Steven D'Aprano wrote: Here is a simple example: http://code.activestate.com/recipes/577896-benchmark-code-with-the-with-statement/ I use that now in my function: #--- def time_test(function,

Re: Function to show time to execute another function

2015-06-07 Thread Mark Lawrence
On 07/06/2015 09:22, Cecil Westerhof wrote: On Sunday 7 Jun 2015 09:39 CEST, Mark Lawrence wrote: On 07/06/2015 07:39, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:51 CEST, Steven D'Aprano wrote: On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 08:39 CEST, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function, *args): startTime = time.time() results =

Re: Function to show time to execute another function

2015-06-07 Thread Johannes Bauer
On 07.06.2015 22:35, Cecil Westerhof wrote: And you also posted your solution. I fail to find any question in your original posting at all. That is because there was no question: I just wanted to share something I thought that could be useful. If you would have taken the trouble to read a

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 09:39 CEST, Mark Lawrence wrote: On 07/06/2015 07:39, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function,

Re: Function to show time to execute another function

2015-06-07 Thread Luca Menegotto
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. Second, often the quality

Re: Function to show time to execute another function

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function, *args): startTime = time.time()

Re: Function to show time to execute another function

2015-06-07 Thread Luca Menegotto
Il 07/06/2015 11:28, Steven D'Aprano ha scritto: But if your function takes less than, say, 1 millisecond, then your timing results are probably just meaningless random numbers, affected more by the other ten thousand processes running on your computer than by the Python code itself. That's

Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function, *args): startTime = time.time() results = function(*args) endTime =

Re: Function to show time to execute another function

2015-06-07 Thread Mark Lawrence
On 07/06/2015 07:39, Cecil Westerhof wrote: Sometimes I just want to know how much time a function takes, but at the same time I also want the result of the function. For this I wrote the following function: def time_test(function, *args): startTime = time.time() results