On Tue, 27 Dec 2022 at 21:29, Antoon Pardon <antoon.par...@vub.be> wrote:
>
> OK, I am writing an alternative for the threading module. What I would
> like to know is how I can get some library modules call my alternative
> instead of the threading module.
>
> For instance there is the logging module, it can log the thread name. So
> I would like to know how I can get the logging module to call the
> function from my module to get the current_thread, instead of it calling
> "current_thread" from the threading module.

Easy: make sure your module is called "threading.py" and is earlier in
the path than the standard library. In fact, it's so easy that people
do it unintentionally all the time... Generally, the current directory
(or the script directory) is the first entry in sys.path, so that's a
good place to put it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to