Open researcher175 opened 7 months ago
Inline method refactoring allows for rich comparison methods. It would be nice if Rope sent an alert to the user to avoid applying the transformation to rich comparison methods.
Steps to reproduce the behavior:
Code before refactoring:
class GFG: def __init__(self, Marks): self.Marks = Marks def _cmpkey(self): return self.Marks def _compare(self, other, method): try: return method(self._cmpkey(), other._cmpkey()) except (AttributeError, TypeError): return NotImplemented def __lt__(self, other): return self._compare(other, lambda s, o: s < o)
student1_marks = GFG(90) student2_marks = GFG(88)
print(student1_marks < student2_marks) print(student2_marks < student1_marks)
2. Apply the Inline Method refactoring to 'GFG.\_\_lt\_\_'
Inline method refactoring allows for rich comparison methods. It would be nice if Rope sent an alert to the user to avoid applying the transformation to rich comparison methods.
Steps to reproduce the behavior:
Code before refactoring:
student1_marks = GFG(90) student2_marks = GFG(88)
print(student1_marks < student2_marks) print(student2_marks < student1_marks)