PyCharm provides the following inline refactorings:
- Inline Variable refactoring replaces redundant variable usage with its initializer. This refactoring is opposite to Extract Variable.
- Inline Constant refactoring. This refactoring is opposite to the Extract Constant refactoring and it results in replacing variables with constants.
- Inline Field refactoring is opposite to the Extract Field refactoring and it results in replacing the selected field with the corresponding expression.
- Inline Parameter refactoring is opposite to the Extract Parameter refactoring and it results in replacing the selected parameter with the expression or local variable declaration.
- Inline Method refactoring results in placing method's body into the body of its callers. This refactoring is opposite to the Extract method refactoring.
- Inline Superclass refactoring results in pushing superclass' methods into the class where they are used, and removing the superclass. This refactoring is opposite to the Extract Superclass refactoring.
Inline Variable Example
| || |
Perform inline refactoring
- Place the caret in the editor at the desired symbol to be inlined.
- Do one of the following:
- On the main menu or on the context menu, choose .
- Press Ctrl+Alt+N.
- In the Inline dialog box that corresponds to the selected symbol, confirm the inline refactoring.
Last modified: 20 August 2018