Zomega / fabricate

Automatically exported from code.google.com/p/fabricate
0 stars 0 forks source link

Make run/shell ignore None args to simplify default=None cases #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On the examples wiki pages, there's this annoying "flags or []" situation:

def link(build_dir='build', flags=None):
    objects = [oname(build_dir, s+'.o') for s in sources]
    run('gcc', objects, '-o', oname(build_dir, target), flags or [])

If shell() removed args that were None, it'd simplify this case. In Python,
it's usually bad to define eg "def link(flags=[]): ..." because the default
of [] is only evaluated once.

Original issue reported on code.google.com by benh...@gmail.com on 12 Aug 2009 at 12:11

GoogleCodeExporter commented 9 years ago
Also consider going str(arg) for all args that aren't str/unicode, so you can 
do say:
shell('tail', '-n', 10)

Original comment by benh...@gmail.com on 13 Aug 2009 at 3:21

GoogleCodeExporter commented 9 years ago
Both fixed in r45.

Original comment by benh...@gmail.com on 13 Aug 2009 at 4:05

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 5ee4f744e8ca.

Original comment by simon.al...@gmail.com on 15 Apr 2013 at 4:38