PyCharm 4.0.4 Help

Inline

PyCharm provides the following inline refactorings:

Example

Before After
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()

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 the main menu or on the context menu of the selection, choose Refactor | Inline .
    • Press Ctrl+Alt+N.
  3. In the Inline dialog box that corresponds to the selected symbol, confirm the inline refactoring.

See Also

Last modified: 3 February 2015
comments powered by Disqus