Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>: > Personally, I believe that print ought to do its own locking. And > print is a statement, although in this case there's no need to support > anything older than 2.6, so something like this ought to work: > > > from __future__ import print_function > > _print = print > _rlock = threading.RLock() > def print(*args, **kwargs): > with _rlock: > _print(*args, **kwargs)
Could this cause a deadlock if print were used in signal handlers? Marko -- https://mail.python.org/mailman/listinfo/python-list