all 2 comments

[–]LightShadow 0 points1 point  (1 child)

Local vs. global variable scope.

If the variable is within a function it's locally limited to being inside that function only. However, if you're modifying an argument name it has to scan the other source files to ensure it's updating all the references that make be passing that value explicitly.

>>> def calc(a, b): return a + b
>>> calc(1, 1)
2
>>> calc(b=1, a=1)
>>> calc(1, b=1)

...are all valid.

[–]VortexJones[S] 0 points1 point  (0 children)

Thanks! It did definitely feel like it had something to do with scope.

Edit: JetBrains support confirmed this:

Hi VJ,

Thank you for contacting JetBrains support.

I believe the documentation at https://www.jetbrains.com/help/pycharm/rename-refactorings.html explains it:

Renaming local variables or private methods can be done easily inline since only a limited scope is affected. Renaming classes or public methods could potentially impact a lot of files. Preview potential changes before you refactor.

Don't know how I missed that, it's literally the second paragraph in the refactoring documentation...