On Tue, 27 Dec 2022 at 23:06, Antoon Pardon <antoon.par...@vub.be> wrote: > > How do you intend to distinguish one from the other? How should the > > logging module know which threading module to use? > > That is my question! How can I get the logging module to use my module.I was > hoping the logging module would allow some kind of dependency > injection, so you can tell it what threading module to use. An other > option might be to manipulate sys.modules. -- Antoon Pardon
But presumably you want OTHER modules to continue using the vanilla threading module? This is likely to end up somewhat hacky. Yes, you can manipulate sys.modules, but there's only one threading module at a time, so you need a way to distinguish between modules that should use the changed one and modules that shouldn't. TBH this is starting to sound like something where you want unittest-type facilities, actually. ChrisA -- https://mail.python.org/mailman/listinfo/python-list