Renaming

Before you start wondering—yes, simply renaming things in a program is still an aspect of refactoring. However, there is more subtlety in renaming than you might imagine. For example, say you'd like to rename a variable in a Python program. This process would be trivial if that variable was only used once or twice throughout the whole program, but if the program you are working with was large enough, and the variable is shared among many components of the program, renaming the variable might prove extremely difficult and time-consuming.

One potential solution is to use the find and replace functionality (which is commonly applicable in this case) to find all the locations in the program that contains that specific variable name and ...

Get Hands-On Application Development with PyCharm now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.