No threading.start_new_thread(), useful addition?
lists at cheimes.de
Sat Oct 10 00:45:21 CEST 2009
Laszlo Nagy wrote:
> IMHO it is much cleaner to implement this as a decorator. Pro:
> transparent passing of positional and keyword arguments, keeps function
You are entitled to your opinion but I STRONGLY recommend against your
decorator. You MUST NOT start threads a a side effect of a module
import. It can lead to severe bugs and dead lock the entire interpreter.
I'm speaking as an experienced Python developer and a CPython core
developer. Please trust me in this. The interaction between the import
system, its global import lock and threads can and will lead to
surprising and hard to debug bugs. A well designed application loads its
modules first and then initializes its components explicitly. You don't
want to fire up threads randomly!
More information about the Python-list