Indentation contains mixed spaces and tabs¶
Per the PEP 8 Style Guide, all Python code should be consistently indented with 4 spaces, never tabs.
Anti-pattern¶
The following code mixes spaces and tabs for indentation. The print("Hello, World!")
statement is indented with a tab. The print("Goodybye, World!")
statement is indented with 4 spaces.
def print_hello_world():
# indented with tab
print("Hello, World!")
def print_goodbye_world():
# indented with 4 spaces
print("Goodbye, World!")