Python IDLE: How to type correct indentation?
- by user2988464
Mac: Maverick
Python: 3.4
I tried to testtimeit module in Python's IDLE
import timeit
>>> timeit.timeit( "obj.method", """
class SomeClass:
def method(self):
pass
obj = SomeClass()
""")
When I tried to type def method(self): on the next line of class SomeClass, I hit Tab, it prompted a window showing the files inside my Document directory. So I hit Ctrl+Tab instead.
But I still got the error:
Traceback (most recent call last):
File "<pyshell#26>", line 6, in <module>
""")
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/timeit.py", line 213, in timeit
return Timer(stmt, setup, timer).timeit(number)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/timeit.py", line 122, in __init__
code = compile(src, dummy_src_name, "exec")
File "<timeit-src>", line 9
_t0 = _timer()
^
IndentationError: unindent does not match any outer indentation level
Can someone explain:
how to fix it, and
how to avoid the prompt of My Document appear?
Thx!!!