The extracted method was defined outside of class scope causing 'NameError'
Steps to reproduce the behavior:
- Code before refactoring:
class TSV:
"""TSV format. Assumes each row is of the form `text\\tlabel`."""
delimiter = "\t"
if __name__ == "__main__":
print(TSV.delimiter)
-
Apply the extract method to "\t"
-
Code after refactoring:
class TSV:
"""TSV format. Assumes each row is of the form `text\\tlabel`."""
delimiter = extracted_method()
def extracted_method():
return "\t"
if __name__ == "__main__":
print(TSV.delimiter)