[issue2527] Pass a namespace to timeit
David W. Lambert
report at bugs.python.org
Sat Jan 24 21:12:13 CET 2009
David W. Lambert <lambertdw at corning.com> added the comment:
This note is simply a reminder that Antoine's 'from __main__ import *'
solution fails in python3. Also, resolution of this issue probably
could incorporate Issue1397474.
>>> import timeit
>>> timeit.timeit('None','from __main__ import *')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.0/timeit.py", line 227, in timeit
return Timer(stmt, setup, timer).timeit(number)
File "/usr/local/lib/python3.0/timeit.py", line 135, in __init__
code = compile(src, dummy_src_name, "exec")
File "<timeit-src>", line 2
SyntaxError: import * only allowed at module level
----------
nosy: +LambertDW
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2527>
_______________________________________
More information about the Python-bugs-list
mailing list