Refactor class method for property using Pycharm

I have the following class:

class Dogs(object):
    def __init__(self):
        self.names = []
        self.breeds = set()

    def number(self):
        return len(self.names)

      

I want to change number

as a property. This means that I also want to change all of his customs. Does PyCharm have refactoring tools built into it? It seems according to this problem .

At this point, I do "find all usages" and then manually commit each instance. If there is no dedicated refactoring tool to change the method for a property, is there a better way to use "find all uses"?

+3
python properties refactoring pycharm automated-refactoring


source to share


No one has answered this question yet

Check out similar questions:

3602
Does Python have a substring method "contains"?
3119
What is the difference between Python list methods that are appended and expanded?
2332
Understanding Python super () with __init __ () methods
1731
Are static class variables possible in Python?
1616
Static methods in Python?
1435
How to efficiently count the number of keys / properties of an object in JavaScript?
994
How do I return multiple values ​​from a function?
975
What is the difference between a field and a property?
866
How does the @property decorator work?
644
Using @property versus getters and setters



All Articles
Loading...
X
Show
Funny
Dev
Pics