On Wed, May 20, 2015 at 3:55 AM, Zachary Ware <zachary.ware+pyl...@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 -- https://mail.python.org/mailman/listinfo/python-list