PyCharm Edu 4.0 Help

Inline

Introduction

PyCharm Edu provides the following inline refactorings:

Example

BeforeAfter
import math class Solver: def demo(self): a = 3 b = 25 c = 46 return_type_of_sqrt = math.sqrt(b ** 2 - 4 * a * c) root1 = (-b + return_type_of_sqrt) / (2*a) root2 = (-b - return_type_of_sqrt) / (2*a) print(root1,root2) Solver().demo()
import math class Solver: def demo(self): a = 3 b = 25 c = 46 root1 = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a) root2 = (-b - math.sqrt(b**2 - 4*a*c)) / (2*a) print(root1,root2) Solver().demo()

Perforaming inline refactoring

To perform the inline refactoring

  1. Place the caret in the editor at the desired symbol to be inlined.
  2. Do one of the following:
    • On on the context menu, choose Refactor | Inline.
    • Press Ctrl+Alt+N.
  3. In the Inline dialog box that corresponds to the selected symbol, confirm the inline refactoring.
Last modified: 15 December 2017