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


Groups > comp.lang.python > #90886

Re: Best way to rewrite Popen

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.071
X-Spam-Evidence '*H*': 0.88; '*S*': 0.02; 'nicely': 0.07; 'cc:addr :python-list': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'kw:': 0.16; 'repetition': 0.16; 'simplified': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'cc:addr:python.org': 0.22; 'case.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'does': 0.39; 'though,': 0.39; 'simple,': 0.60; 'simple': 0.61; "you're": 0.61; '20,': 0.68; '2015': 0.84; 'subject:Best': 0.91; 'ware': 0.91; 'to:none': 0.92
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=YAdubOhRV4aredWJIYhETgfoxb/FAfXycOqh1Zn7lrw=; b=eacyK6b5EwYFleihhEBWItnJQVg86z63sZDvZW4HBd7LKDdpqsma61RBCFpjVbbv+l +N6e36N7R599SJeKuVa3Uxky3lUukgtHcrqREA2I7Ca6DEVq3b7hM7TXGpvZGuX0A2rG xhwFX2FfV89BpNgTVPeEcds5asjEuRTrtl0yedVI76/kOn417TCNbvbRypdUreHPrUql HfrUuhqtcKN1AzmDuhYfZrgxL8bj0b8BpJU5sDrZFu21kxPkaJLsIAAdQ/48YngBiZmT m14OOli7IR5C/q8jXNETC9RD7Wcch8mo0gGtK3SMa8jlfT5s3R4wZwtQKDm7oWic6EAz 2vVg==
MIME-Version 1.0
X-Received by 10.107.16.32 with SMTP id y32mr37664235ioi.53.1432059233415; Tue, 19 May 2015 11:13:53 -0700 (PDT)
In-Reply-To <CAKJDb-PBHtBpF_U6ug7zPJQTdH1vzFjz=SLAuW-2o8RYqhdG8Q@mail.gmail.com>
References <87siastsby.fsf@Equus.decebal.nl> <CAPTjJmpMApx8Ptm=fcstWDY5MxZsLn5T7_Yod4QCyHWYHKAGOg@mail.gmail.com> <CAKJDb-PBHtBpF_U6ug7zPJQTdH1vzFjz=SLAuW-2o8RYqhdG8Q@mail.gmail.com>
Date Wed, 20 May 2015 04:13:53 +1000
Subject Re: Best way to rewrite Popen
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.152.1432059241.17265.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432059241 news.xs4all.nl 2969 [2001:888:2000:d::a6]:46599
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90886

Show key headers only | View raw


On Wed, May 20, 2015 at 3:55 AM, Zachary Ware
<zachary.ware+pylist@gmail.com> wrote:
>> def capture_stdout(*a, **kw):
>>     if 'stdout' not in kw: kw['stdout'] = subprocess.PIPE
>
> Just a quick note that this line can be simplified nicely to:
>
> kw.setdefault('stdout', subprocess.PIPE)

Yes, in the simple case. That does require pre-evaluating
subprocess.PIPE though, which in some situations is an important
distinction. But you're right, for something this simple, the
repetition is superfluous. Good catch.

ChrisA

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


Thread

Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 19:01 +0200
  Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 17:36 +0000
    Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 21:13 +0200
      Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 20:14 +0000
      Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 22:19 +0200
        Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 21:28 +0000
          Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 00:23 +0200
            Re: Best way to rewrite Popen MRAB <python@mrabarnett.plus.com> - 2015-05-20 00:20 +0100
              Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 02:15 +0200
  Re: Best way to rewrite Popen Jonas Wielicki <jonas@wielicki.name> - 2015-05-19 19:43 +0200
  Re: Best way to rewrite Popen Chris Angelico <rosuav@gmail.com> - 2015-05-20 03:47 +1000
  Re: Best way to rewrite Popen Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-05-19 12:55 -0500
  Re: Best way to rewrite Popen Chris Angelico <rosuav@gmail.com> - 2015-05-20 04:13 +1000
  Re: Best way to rewrite Popen Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-20 03:23 +0200

csiph-web