Python has some nice features for refactoring:
- no seagull wings (i.e. { and }) to move around
- simple inheritance syntax makes it easy to change class structures
- no header files to maintain
- everything is first-class object
- you can play with namespaces (substituting a module/class/.. with a mock module/class/.. is a piece of cake) and change/modify modules/classes/objects in run-time.
- it has named parameters with default values (easy when need to add parameters but you don't want to break other calls)
- it has very strong reflection support
I am truly hooked on PyCharm - despite the rest of it is a peesa-crap JavaLanguage editor that's slow and fills my swapper file up with billions of pcodes that I will never use. It has ExtractVariableRefactor? and ExtractMethodRefactor. I don't _want_ to do any more advanced refactors automatically... --
PhlIp
Things to watch out for:
- As with similar dynamically typed languages, Python has fewer compile-time checks to catch things like typos on RenameMethod. Good UnitTests minimize your risk here.
See BicycleRepairMan, PythonRefactorings
CategoryPython CategoryRefactoring