Re: Please help with Threading

Discussion in 'Python' started by Fábio Santos, May 20, 2013.

  1. It is pretty cool although it looks like a recursive function at first ;)
    On 20 May 2013 10:13, "Chris Angelico" <> wrote:

    > On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson <> wrote:
    > > _lock = Lock()
    > >
    > > def lprint(*a, **kw):
    > > global _lock
    > > with _lock:
    > > print(*a, **kw)
    > >
    > > and use lprint() everywhere?

    >
    > Fun little hack:
    >
    > def print(*args,print=print,lock=Lock(),**kwargs):
    > with lock:
    > print(*args,**kwargs)
    >
    > Question: Is this a cool use or a horrible abuse of the scoping rules?
    >
    > ChrisA
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    Fábio Santos, May 20, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KK
    Replies:
    2
    Views:
    552
    Big Brian
    Oct 14, 2003
  2. Replies:
    9
    Views:
    1,036
    Mark Space
    Dec 29, 2007
  3. silkenpy
    Replies:
    1
    Views:
    353
    Dennis Lee Bieber
    Feb 15, 2008
  4. Steven Woody
    Replies:
    0
    Views:
    406
    Steven Woody
    Jan 9, 2009
  5. Steven Woody
    Replies:
    0
    Views:
    446
    Steven Woody
    Jan 9, 2009
Loading...

Share This Page