[Guido van Rossum]
try: import threading except ImportError: threading = None # use non-threaded behaviour
But then you'd have to sprinkle the rest of the code with "if threading is not None" tests. Brett's dummy_thread is an attempt to reduce this clutter.
the problem (if there is one) is that the proposed integration may break code that uses the above pattern.
But if it does it will be on platforms it couldn't run on previously. ``threading`` uses ``thread`` when possible and only falls back on ``dummy_thread`` when it isn't available. That means this could only be a problem where the code was not even runnable before.
But yes, there are chances of deadlock in certain situations. It basically comes down to whether we want to protect users from themselves by not having them get into a possible deadlock situation.
I don't propose to automate this. I propose this:
try: import threading except ImportError: import dummy_threading as threading
So is this an indirect request for me to write ``dumy_threading``? If it is it won't be hard: I would do an ``import *`` on ``threading`` and then override the functions it uses from ``thread`` with ``import ... from ... as ...`` from ``dummy_thread``. Also would mean rewriting the ``threading`` testing suite. Prefectly happy to write it, just need you to say you want it.