Refactoring example with PyCharm
- Change variable name (in scope only)
def add(x, y):
z = x + y
return z
def multiply(x, y):
z = x * y
return z
x = 2
y = 3
z = add(x, y)
print(z)
z = multiply(x, y)
print(z)
- Extract method
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
def add(x, y):
z = x + y
return z
def multiply(x, y):
z = x * y
return z
x = 2
y = 3
z = add(x, y)
print(z)
z = multiply(x, y)
print(z)