views:

51

answers:

1

Hi,

I am using Pydev on Eclipse to write python code. I am new to Pydev and to Eclipse. I love the feature where by I can use rightClick -> Refactoring -> Rename... to rename a variable.

I was wondering if there is something similar to change a function everywhere in the project, if I change its definition.

For example, suppose I initially have:

def myFunction(a, b):
    body of the function
    return blah

I use this function in other files of the project. Say,

thisVar = myFunction(a, b)

Now I feel the need to change the function definition to account for an additional parameter.

def myFunction(a, b, c):
    body of the function
    return blah

Is there something in eclipse or pydev such that it will automatically change

thisVar = myFunction(a, b)

to

thisVar = myFunction(a, b, c)

Thanks for your help.

+2  A: 

no IDE may support this as when you call a function it requires variable which may not be the c all the time,

what I suggest is keep the parameter c as optional like

thisVar = myFunction(a, b, c = None)

and when you actually realize that it requires c then you can call those statements by using 3 parameters or myFunction(10,20, c = 2000)

Tumbleweed
+1 In fact, it's rather unlikely that there is a `c` at call side.
delnan