Error:
Used when there are some mixed tabs and spaces in a module.
Found indentation with tabs instead of spaces
Found indentation with spaces instead of tabs
Description
Raised by pylint, when a mix of both spaces and tabs is used for indentation purpose. Precisely, when an indent is detected that is not consistent with the indent-string option. By default, indent-string is set to four spaces, the style of indentation recommended in PEP-8. This error is not
fatal but considered a bad
practice and could result in unexpected behavior.
Example(s)
Given sample of code describe
basic divide function, it takes
two arguments a and b. We have simple divided first argument with second
and
returned result. We have used spaces and tab both to represent as single indentation
"""
function to take two arguments to divide first by second
"""
try:
result = a/b
except ZeroDivisionError:
result = 0
return result
Solution(s)
PEP recommend four spaces to be used as indentation, So this could be resolved using standard four spaces for indentation.
Use Four spaces
Use four spaces for single indentation.
def divide(a, b):"""
function to take two arguments to divide first by second
"""
try:
result = a/b
except ZeroDivisionError:
result = 0
return result
I am still gettting this issue
ReplyDeleteI am only using tabs but getting this error. very annoying
ReplyDelete