Change signature
The Change Signature refactoring combines several different modifications that can be applied to a function signature. You can use this refactoring to:
change the function name
add, remove, and reorder parameters
assign default values to the parameters
When changing a function signature, PyCharm searches for all usages of the function and updates all the calls, implementations, and override replacements of the function that can be safely modified to reflect the change.
Changing a function signature
Position the caret at the name of the function that you want to refactor.
Press Ctrl+F6. Alternatively, select
from the main menu or from the context menu.In the Change Signature dialog, make necessary changes to the function signature depending on your needs:
Change the function name. To change the name, edit the text in the Name field.
Manage the function parameters. To configure the parameters, use the table and the buttons in the Parameters area:
To add a new parameter, click and specify the new parameter's properties in the corresponding table row.
To remove a parameter, select any row and click .
To reorder the parameters, click and . For example, if you want to put a certain parameter first in the list, click any of the cells in the row corresponding to that parameter, and then click the required number of times.
You can specify the default value of the newly added parameter. Do not select the Use default value in signature checkbox to use the specified value in existing calls as an explicit placeholder.
Click Refactor.
To see the expected changes and make adjustments prior to the refactoring, click Preview.