Pattern: Indentation contains mixed spaces and tabs
Issue: -
Indentation has both tabs and spaces in it. Programmers should use either tabs or spaces, but not both.
Note: The •
character represents a space and the →
character represents a tab.
In this example, the third line contains four spaces and two tabs.
def get_name(self):
if self.first_name and self.last_name:
••••→ → return self.first_name + ' ' + self.last_name
else:
return self.last_name
Change the line to use spaces only.
def get_name(self):
if self.first_name and self.last_name:
••••••••return self.first_name + ' ' + self.last_name
else:
return self.last_name