Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:10:12+00:00 2026-05-25T19:10:12+00:00

Question I’ve written a replacement threading module for Python. What’s the best method to

  • 0

Question

I’ve written a replacement threading module for Python. What’s the best method to go about hooking all uses of the usual threading module from the standard library with my own? The hooking should be opt-in, and on a per project, or per executable basis.

When this statement is executed:

import threading

I want my module to be loaded instead of the default.

Note that in future, I may also hook several of the other standard modules, so a solution that addresses hooking a few modules is best.

Why

I’ve implemented IO concurrency via greenlets and Linux’s eventfd() and epoll() system calls. It works transparently except for a sys.modules hook and a replacement socket class. Looking to make this hooking nicer and more consistent.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:10:13+00:00Added an answer on May 25, 2026 at 7:10 pm

    You might try using python’s meta_path hook:

    http://www.python.org/dev/peps/pep-0302/

    It’ll allow you add an object which can override part of the importing process. I think you’ll be able to substitute your own modules for the standard modules with that way. I’m not sure its better then patching sys.modules though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question says it all, really. My application is a time tracker. It's currently written
Question Alright, I'm confused by all the buzzwords and press release bingo going on.
Question in the title. And what happens when all 3 of $_GET[foo] , $_POST[foo]
Question Is there a way to have a method that will always run anytime
Question from the one interview. Please explain what does this C++ code mean: void
Question: Anybody has experience with ZedGraph / MS-Chart controls ? I am thinking about
My question is about memory use and objects in actionscript 2. If I have
Question 1 I want to make IPhone application that uses OpenID for authentication. I
Question: Can I use the multiprocessing module together with gevent on Windows in an
Question: I want to populate a LINQ table from code, not DataBase. Is it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.