python-rope / rope

a python refactoring library
GNU Lesser General Public License v3.0
1.93k stars 162 forks source link

Rename Method refactoring is allowed in methods of the descriptor protocol #771

Open researcher175 opened 7 months ago

researcher175 commented 7 months ago

Steps to reproduce the behavior:

  1. Code before refactoring:
    
    class Descriptor:
    def __get__(self, instance, owner):
        return 40

2. Apply the Rename Method refactoring to the method \_\_get\_\_.

3. Expected code after refactoring: the same as the original. It would be nice if Rope could emit a warning that applying the refactoring to this type of class is not allowed.

Rope produces the result below:

```python
class Descriptor:
    def value(self, instance, owner):
        return 40