timeit and __future__

Steven D'Aprano steve at REMOVETHIS.cybersource.com.au
Sat Jun 20 09:39:51 EDT 2009

Karl Chen wrote:

> I wanted to time something that uses with_statement, in python2.5.
> Importing __future__ in the statement or the setup doesn't work
> since it's not the beginning of the code being compiled.  Other
> than using a separate module, I could only come up with this:
>     timeit.template = 'from __future__ import with_statement\n' +
>     timeit.template
> timeit should directly support importing __future__ stuff...

Yes, it probably should. Please make a bug report/feature request at the
Python bug tracker. If you have a patch, that would be even better.



More information about the Python-list mailing list