As I read the question
. I came up with an idea. But I don't know the consequences of my guesswork.
My idea is that change the import strategy
by modify the sys.modules
, then change the import things without modify old code.
Edit 1
A situation use the method
Hack code:
try:
import concurrent.futures
except ImportError:
concurrent.futures = wrapper_futures
Then this code can use for python2 and python3
Old code:
from concurrent.futures import Future