Refactoring is basic activity that all developers do. This post summarizes interesting talk, learn how to do them more effectively
Refactoring is basic activity that all developers do. This post summarizes interesting talk, learn how to do them more effectively
Refactoring is often not budgeted. But as Brett Slatkin mentions in his PyCon 2016 talk it is one of the most important thing experienced developers get into habbit of doing. Following is summary of the talk
What is refactoring?
When do you refactor?
Complexity
What’s the difference between good and great programmer?
How do you refactor?
How do you refactor in practice?
Book Recommendations
Strategies
def __bool__(self)
. Now replace functional version with class version (Aka Non-zero)__boo__
to indicate a class is a paper trailHow do you redraw boundaries?
import warnings
warnings.warn("something")
python -W error your_code.py
will convert warnings to errorsPet
class to Animal
Raise TypeError for mixed usages (old and new one)
Things to Remember:
__init__
@property
to move methods and fields between classes