rope icon indicating copy to clipboard operation
rope copied to clipboard

Document IntroduceParameter refactoring

Open Wilfred opened this issue 9 years ago • 3 comments

I'd like to be able to do the following refactoring:

# before
def foo():
    bar(some_expr)

# after
def foo(new_param=some_expr):
    bar(new_param)

Could this be added to rope?

Additional acceptance criteria:

  • [ ] Update documentation

Wilfred avatar Aug 04 '15 09:08 Wilfred

That's an interesting idea. I think there is some complexity in it, for example if the expression being moved references variables defined in the function scope.

If you would like to add this capability, we would gratefully accept a pull request.

soupytwist avatar Oct 02 '16 06:10 soupytwist

It seems to me a bit dangerous: mutable default arguments are evil, so the code would have to check that it doesn’t do The Bad Thing™.

mcepl avatar Oct 02 '16 06:10 mcepl

This seems to have already been supported by the IntroduceParameter refactoring.

It is currently undocumented and I don't think currently there are any editor integration currently that implements them though.

lieryan avatar Sep 29 '21 05:09 lieryan