Christian Heimes wrote:
Laszlo Nagy wrote:

IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation.


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!

Christian

Okay, I for one will never start threads as a side-effect of module import.

Other than that, are there other inherent problems with using that decorator at non-import times?

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to