Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Robert Kern
Jari Aalto wrote: > Thanks, is there equivalent to this Perl statement in Python? > >@list = @ARGV[1 .. @ARGV]; > > or something similar so that I could avoid the 1 > 1 (sys.argv) check > altogether? for arg in sys.argv[1:]: ... -- Robert Kern [EMAIL PROTECTED] "In the fields of hell

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Jari Aalto
"Chris F.A. Johnson" <[EMAIL PROTECTED]> writes: > On 2005-10-15, Jari Aalto wrote: >Don't indent: > > function compile () > { > python -c ' > import os, sys, py_compile; > i = 0; > for arg in sys.argv: > file = os.path.basename(arg); > dir = os.path.dirname(arg); >

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Chris F.A. Johnson
On 2005-10-15, Jari Aalto wrote: > > [Keep CC, thank you] > > Please suggest comments how can I make this script to work > from bash. Also how can I skip better the [0] argument from > command line without hte extra variable i? > > #!/bin/bash > > function compile () > { > pyth

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Jari Aalto
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Jari Aalto wrote: > | > Please suggest comments how can I make this script to work | > from bash. > > replace it with a call to the compileall module? > > $ python -mcompileall [directory...] Thanks, but that will not work. The files are gathered

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Maarten van Reeuwijk
Jari Aalto wrote: > > [Keep CC, thank you] > > Please suggest comments how can I make this script to work > from bash. Also how can I skip better the [0] argument from > command line without hte extra variable i? Didn't check, but something like this? #!/bin/python import os, sys, py_compile;

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Fredrik Lundh
Jari Aalto wrote: > Please suggest comments how can I make this script to work > from bash. replace it with a call to the compileall module? $ python -mcompileall [directory...] ? $ python -mcompileall -h option -h not recognized usage: python compileall.py [-l] [-f] [-q] [-d d

how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Jari Aalto
[Keep CC, thank you] Please suggest comments how can I make this script to work from bash. Also how can I skip better the [0] argument from command line without hte extra variable i? #!/bin/bash function compile () { python -c ' import os, sys, py_compile; i