Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.125 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.77; '*S*': 0.01; 'sure,': 0.09; 'cc:addr :python-list': 0.11; 'expecting': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simpson': 0.16; 'slow,': 0.16; 'stdout': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'nature': 0.30; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; "user's": 0.31; 'becomes': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'pm,': 0.38; 'that,': 0.38; 'expect': 0.39; '12,': 0.39; 'enough': 0.39; 'how': 0.40; 'even': 0.60; 'free': 0.61; 'production': 0.68; 'apart': 0.72; 'day': 0.76; 'notable': 0.91; 'ratio': 0.91; 'to:none': 0.92; 'silent': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=wZLXC6z528gbGm8tzZS5hrj8R/27NpTTbUopHmFsOwU=; b=TeiTVE0V0KO4heV3NRFJsPqX/+yXD3RQmQGTsEMxO+JrfkUvq9SL9gp0eP54+RGWnM hnlRpCAvmtV8jrwJ0WYhKgvjs0phewFNTvN0Gk/MPLjeLFxuK5hnzkYzeM1Z7Dw4anIj Mknd9B7x+gmjIfCbu9GUHrVBuE5CXxgjLET1Spzge3xo6wNl2JeGptbFyNb0K1AuJiBI PPzdRkhRgeOKnY3FQT0hFV/jtYPoc29bnZMJ3dBTUMVixtlRnPGZ0xCq/p8KeroCM1AQ 6Eq5Mw0VvC1HxR+jOHRr/+1G3YDvFKo1jfyCwb/xNX7xoCbZj7eaReeQJJjDW9tM1Itt 5UYw== MIME-Version: 1.0 X-Received: by 10.50.88.37 with SMTP id bd5mr6153850igb.1.1407851583778; Tue, 12 Aug 2014 06:53:03 -0700 (PDT) In-Reply-To: <20140812043104.GA21661@cskk.homeip.net> References: <53e9583b$0$29973$c3e8da3$5496439d@news.astraweb.com> <20140812043104.GA21661@cskk.homeip.net> Date: Tue, 12 Aug 2014 23:53:03 +1000 Subject: Re: Is print thread safe? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407851593 news.xs4all.nl 2902 [2001:888:2000:d::a6]:40344 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76114 On Tue, Aug 12, 2014 at 2:31 PM, Cameron Simpson 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