On 4/8/2012 7:04, Bryan wrote:
Kiuhnm wrote:
My question is this: can I use 'threading' without interfering with the
program which will import my module?
Yes. The things to avoid are described at the bottom of:
http://docs.python.org/library/threading.html
On platforms without threads, 'import threading' will fail. There's a
standard library module dummy_threading which offers fake versions of
the facilities in threading. It suggests:
try:
import threading as _threading
except ImportError:
import dummy_threading as _threading
I have a decorator which takes an optional argument that tells me
whether I should use locks.
Maybe I could import 'threading' only if needed. If the user wants to
use locks I'll assume that 'threading' is available on his/her system.
By the way, should I avoid to 'import threading' more than once?
Thank you so much for answering my question.
Kiuhnm
--
http://mail.python.org/mailman/listinfo/python-list