モジュールにモンキーパッチを適用する場合:
# mokeypatch.py
import other_module
def replacement(*args, **kwargs):
pass
other_module.some_func = replacement
これは直接インポートするモジュールに影響しますsome_func
か、それともインポートの順序に依存しますか?3番目のモジュールが次のような場合:
# third_module.py
from other_module import some_func
最初にこのコードが実行され、次にモンキーパッチが実行されます。third_module.some_func
古いものになりますか?