Re: Best way to rewrite Popen

2015-05-19 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do this? > So cr

Re: Best way to rewrite Popen

2015-05-19 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do this? > So cr

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Wednesday 20 May 2015 01:20 CEST schreef MRAB: > On 2015-05-19 23:23, Cecil Westerhof wrote: >> Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: >> >>> On 2015-05-19, Cecil Westerhof wrote: It looks like that this does what I want (the dot is needed so that it also works with 2

Re: Best way to rewrite Popen

2015-05-19 Thread MRAB
On 2015-05-19 23:23, Cecil Westerhof wrote: Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: On 2015-05-19, Cecil Westerhof wrote: It looks like that this does what I want (the dot is needed so that it also works with 2.7): files = sorted(os.listdir('.')) p = re.compile('actions-2015-05

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: > On 2015-05-19, Cecil Westerhof wrote: >> It looks like that this does what I want (the dot is needed so that >> it also works with 2.7): files = sorted(os.listdir('.')) p = >> re.compile('actions-2015-05-[0-9][0-9].sql$') current_month = [

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > It looks like that this does what I want (the dot is needed so that it > also works with 2.7): > files = sorted(os.listdir('.')) > p = re.compile('actions-2015-05-[0-9][0-9].sql$') > current_month = [ file for file in files if p.match(file) ] Yo

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 21:13 CEST schreef Cecil Westerhof: > Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > >> On 2015-05-19, Cecil Westerhof wrote: >>> At the moment I am playing with things like: p = >>> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >>> >>> I think

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > >> On 2015-05-19, Cecil Westerhof wrote: >>> At the moment I am playing with things like: p = >>> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >>> >>> I think that most of the tim

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > On 2015-05-19, Cecil Westerhof wrote: >> At the moment I am playing with things like: p = >> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >> >> I think that most of the times this are the values I want. So it >> would b

Re: Best way to rewrite Popen

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:55 AM, Zachary Ware 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 requ

Re: Best way to rewrite Popen

2015-05-19 Thread Zachary Ware
On May 19, 2015 12:48 PM, "Chris Angelico" wrote: > > On Wed, May 20, 2015 at 3:01 AM, Cecil Westerhof wrote: > > At the moment I am playing with things like: > > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > > > I think that most of the times this are the values I

Re: Best way to rewrite Popen

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:01 AM, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is

Re: Best way to rewrite Popen

2015-05-19 Thread Jonas Wielicki
On 19.05.2015 19:01, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do

Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
At the moment I am playing with things like: p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) I think that most of the times this are the values I want. So it would be nice to overrule the defaults. What is the best way to do this? So creating a function that is exactly th