Hello, I was reading the thread on try/except overhead and decided to try Alex's examples but they kept generating exceptions. So I went to the docs and tried the examples there (copied and pasted) with the same results (Win2k, Python 2.4). Any help is appreciated. The output follows: #1 C:\Python24\Lib>timeit.py 'if hasattr(int, "__nonzero__"): pass' Traceback (most recent call last): File "C:\Python24\Lib\timeit.py", line 285, in ? sys.exit(main()) File "C:\Python24\Lib\timeit.py", line 249, in main t = Timer(stmt, setup, timer) File "C:\Python24\Lib\timeit.py", line 116, in __init__ code = compile(src, dummy_src_name, "exec") File "<timeit-src>", line 6 'if ^ SyntaxError: EOL while scanning single-quoted string
#2 C:\Python24\Lib>timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' Traceback (most recent call last): File "C:\Python24\Lib\timeit.py", line 285, in ? sys.exit(main()) File "C:\Python24\Lib\timeit.py", line 249, in main t = Timer(stmt, setup, timer) File "C:\Python24\Lib\timeit.py", line 116, in __init__ code = compile(src, dummy_src_name, "exec") File "<timeit-src>", line 7 ' ^ SyntaxError: EOL while scanning single-quoted string Thanks again, Louis -- http://mail.python.org/mailman/listinfo/python-list