George Sakkis wrote:
> I'm afraid that the taken approach is worse than your patch. For one
> thing, it allows only zero-arg functions. Of course one can work
> around it by passing "lambda: f(...)" but that's adding extra overhead
> which can be measurable for small fast functions. Even if passin
On Mar 31, 6:15 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > On Mar 30, 9:03 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> >> Steven D'Aprano wrote:
> >> > On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
>
> >> >> Second try:
> >> > ...
> >> >> Horrible, I know.
George Sakkis wrote:
> On Mar 30, 9:03 am, Peter Otten <[EMAIL PROTECTED]> wrote:
>> Steven D'Aprano wrote:
>> > On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
>>
>> >> Second try:
>> > ...
>> >> Horrible, I know. Those wrapper1,wrapper2,wrapper3... keep growing
>> >> with each call.
On Sun, 30 Mar 2008 15:03:21 +0200, Peter Otten wrote:
> Maybe the following enhancement of timeit would be worthwhile?
[snip]
Passing a namespace argument would be excellent.
> By the way, haven't we been there before, two years ago?
>
> http://mail.python.org/pipermail/python-list/2006-Februa
On Mar 30, 9:03 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> Steven D'Aprano wrote:
> > On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
>
> >> Second try:
> > ...
> >> Horrible, I know. Those wrapper1,wrapper2,wrapper3... keep growing with
> >> each call. But it's the only way I could
Steven D'Aprano wrote:
> On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
>
>> Second try:
> ...
>> Horrible, I know. Those wrapper1,wrapper2,wrapper3... keep growing with
>> each call. But it's the only way I could find, at least without changing
>> the code template used by timeit.
On Sun, 30 Mar 2008 10:55:25 +, Steven D'Aprano wrote:
> Perhaps it's time for me to take a different approach. Since I can't
> call timeit, and I can't inherit from it (same problem with state being
> shared between instances), perhaps I should write my own timer.
>
>
> import timeit
> impo
On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
> Second try:
...
> Horrible, I know. Those wrapper1,wrapper2,wrapper3... keep growing with
> each call. But it's the only way I could find, at least without changing
> the code template used by timeit.
Eeek. Talk about namespace pollut
On Sun, 30 Mar 2008 00:27:45 -0300, Gabriel Genellina wrote:
> En Sat, 29 Mar 2008 23:23:07 -0300, Steven D'Aprano
> <[EMAIL PROTECTED]> escribió:
>
>> The general problem is that I wish to time an arbitrary function with
>> arbitrary arguments. The function and arguments are provided to me as
>>
En Sun, 30 Mar 2008 00:20:34 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> On Sat, 29 Mar 2008 21:12:33 -0300, Gabriel Genellina wrote:
>
>> def main():
>>global func
>>func = factory()
>>return timeit.Timer('func()', 'from __main__ import func').timeit()
>
> Alas, this does
En Sat, 29 Mar 2008 23:23:07 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> The general problem is that I wish to time an arbitrary function with
> arbitrary arguments. The function and arguments are provided to me as
> Python objects, but timeit requires strings. Converting the objects
On Sat, 29 Mar 2008 21:12:33 -0300, Gabriel Genellina wrote:
> Or maybe:
>
> def main():
>global func
>func = factory()
>return timeit.Timer('func()', 'from __main__ import func').timeit()
Alas, this does not work, because all the Timer instances share the same
state.
import time
On Sat, 29 Mar 2008 21:12:33 -0300, Gabriel Genellina wrote:
> En Sat, 29 Mar 2008 07:33:40 -0300, Steven D'Aprano
> <[EMAIL PROTECTED]> escribió:
>
>> The timeit.Timer class times "code snippets" -- you pass it strings
>> rather than function objects. That's good for what it's worth, but
>> some
En Sat, 29 Mar 2008 07:33:40 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> The timeit.Timer class times "code snippets" -- you pass it strings
> rather than function objects. That's good for what it's worth, but
> sometimes the code you want to time is too big to easily pass as a
> stri
The timeit.Timer class times "code snippets" -- you pass it strings
rather than function objects. That's good for what it's worth, but
sometimes the code you want to time is too big to easily pass as a
string, or maybe you only have access to a function object without the
source, or for whateve
15 matches
Mail list logo