Menu

#469 pull up / push down refactoring

open
nobody
5
2010-06-29
2010-06-29
harryp
No

in eclipse for java, there's an option to take a method from a class and either "pull it up" or "push it down" the class hierarchy - that's the most similar function i've come across.

in fact, what i often want to do is more simple: take a method i've defined as belonging to a class, and make it a global method:

class A:
def my_method(self, param1, param2):
return param1 + param2 #or something

def another_method(self, param1):
return self.my_method(param1,42)

goes to

def my_method(param1, param2):
return param1 + param2

class A:
def another_method(self, param1):
return my_method(param1,42)

so, currently, there's quite a lot of work to manually strip out the self-dots. and it wouldn't work for many class methods, because they would change other self. parameters... still, it seems like this should be automisable, for at least some class methods if not all.

for bonus points: add the ability to drag & drop methods from one class to another? insofar as there's unambiguous ways of doing so?

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.