Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

2 votes
2 answers
208 views

Is there a generic way to make deep recursive functions work without changing system recursion limit?

We have a Python codebase containing quite a lot recursive functions, they may run into deep recursions and break the recursion limit with default Python interpreter settings. We have used sys....
freeswan's user avatar
1 vote
0 answers
343 views

Customize Refactoring for Python in Visual Studio Code

This is a small quality of life issue, but I'm curious if there is a solution. I'm working with a python file in visual studio code. I'm using the "Extract Method" feature to do some ...
Zimos's user avatar
  • 11
2 votes
1 answer
225 views

Automatic replacement of indirect imports

I have a small module that defines a function: # small_file.py def func(): ... I have a larger module that does a wildcard import of that one: # giant_file.py from small_file import * ... I have ...
dshin's user avatar
  • 2,438
6 votes
4 answers
2k views

Automatically Update Python source code (imports)

We are refactoring our code base. Old: from a.b import foo_method New: from b.d import bar_method Both methods (foo_method() and bar_method()) are the same. It just changed the name an the package. ...
guettli's user avatar
  • 27k
1 vote
1 answer
98 views

Pycharm refactoring member function to __call__(...)?

Lets say I have the following class: class Foo: def __init__(self): pass def do_something(self, x): return x bar = Foo() baz = Foo() bru = Foo() print(bar.do_something(3)) ...
Krupip's user avatar
  • 5,007
2 votes
0 answers
94 views

How do I match multiple arguments in rope?

Note: rope is a tool for building Python refactoring into editors like Emacs and vim. It can also be used directly to execute refactors outside of an editor. I'm trying to apply a restructuring to a ...
qff's user avatar
  • 5,992
2 votes
1 answer
576 views

What is the best way to replace a function call in a script?

Consider this line of Python: new_string = change_string(old_string) If you want to replace or remove the function call and just have new_string = old_string, a simple text replacement will not ...
I'm Root James's user avatar
0 votes
1 answer
186 views

Is this a PyCharm 2017.2.2 refactoring limitation, or a coding error?

I'm a fan of JetBrains IntelliJ, and now am enjoying the support PyCharm offers for Python. But I'm having trouble trying to refactor some python code correctly with PyCharm 2017.2.2. I can ...
John's user avatar
  • 6,813
14 votes
1 answer
5k views

Moving function/method to class

Using pycharm, I wish to refactor methods into a class. (Staticmethod would do) Current: import math class Solver(object): def __init__(self, a, b, c): self.a = a self.b = b ...
oria general's user avatar
11 votes
1 answer
2k views

Refactor class method to property using Pycharm

I have the following class: class Dogs(object): def __init__(self): self.names = [] self.breeds = set() def number(self): return len(self.names) I want to change ...
Seanny123's user avatar
  • 9,406
6 votes
1 answer
4k views

Automatically simplifying/refactoring Python code (e.g. for loops -> list comprehension)? [closed]

In Python, I really enjoy how concise an implementation can be when using list comprehension. I love to do concise list comprehensions this: myList = [1, 5, 11, 20, 30, 35] #input data bigNumbers = [...
solvingPuzzles's user avatar
4 votes
2 answers
1k views

why doesn't eclipse-python have magic refactor?

Eclipse is able to utilize compiled bytecode to enable "magic refactor" functionality--renaming methods, tracing up and down class hierarchies and tracing through method calls. What technical ...
Dustin Getz's user avatar
  • 21.9k