Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python Tools for Visual Studio

You're reading from  Python Tools for Visual Studio

Product type Book
Published in Apr 2014
Publisher
ISBN-13 9781783288687
Pages 122 pages
Edition 1st Edition
Languages

Refactoring


Refactoring is one of the biggest advancements in modern IDEs. It significantly cuts down on time and reduces the margin of error by the way in which it handles changes in the code and automated operations. Visual Studio comes with great out-of-the-box refactoring functionalities such as renaming and the creating method from a selected piece of code.

The renaming functionality can really help with potential errors in code, such as when changing the name of an element. There might be instances in the codebase where the old name is still used. Let's have a look at the following code:

class foo:
    """
    Documentation of the class.
    It can be multiline and contain any amount of text
    """
    @classmethod
    def bar(self, first=0, second=0):
        """This is the documentation for the method"""
        return first + second

print(foo.bar())

In this code, there's a class, foo, that has a method called bar. If bar is renamed, it will create an error by referencing to a nonexistent...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}