Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76114

Re: Is print thread safe?

References <53e9583b$0$29973$c3e8da3$5496439d@news.astraweb.com> <20140812043104.GA21661@cskk.homeip.net>
Date 2014-08-12 23:53 +1000
Subject Re: Is print thread safe?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12886.1407851593.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Aug 12, 2014 at 2:31 PM, Cameron Simpson <cs@zip.com.au> wrote:
> I would expect file.write to be fast enough that the lock would usually be
> free.

Until the day when it becomes really REALLY slow, because your
program's piped into 'less' and the user's paging through it. But even
apart from that, writing to stdout can take a notable amount of time.
Expecting the lock to usually be free will depend on the nature of the
program - how much of it is spent in silent computation and how much
in production of output. If that ratio is sufficiently skewed, then
sure, the lock'll usually be free.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Is print thread safe? Steven D'Aprano <steve@pearwood.info> - 2014-08-11 07:44 +0000
  Re: Is print thread safe? INADA Naoki <songofacandy@gmail.com> - 2014-08-11 19:19 +0900
    Re: Is print thread safe? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-12 02:07 +1000
      Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 07:53 +1000
        Re: Is print thread safe? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-12 09:56 +1000
          Re: Is print thread safe? Chris Angelico <rosuav@gmail.com> - 2014-08-12 10:14 +1000
          Re: Is print thread safe? Marko Rauhamaa <marko@pacujo.net> - 2014-08-12 08:01 +0300
            Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 16:15 +1000
          Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 14:31 +1000
          Re: Is print thread safe? Chris Angelico <rosuav@gmail.com> - 2014-08-12 23:53 +1000

csiph-web