Re: Opinion on best practice...

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 5:29 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: If you want the real nightmare -- look into the IBM queue scheme (not many REXX implementations except on IBM mainframes support that). One can push lines onto the queue, such that when the script exits, the

Re: Opinion on best practice...

2013-02-08 Thread John Ladasky
On Tuesday, February 5, 2013 5:55:50 PM UTC-8, Steven D'Aprano wrote: To do anything meaningful in bash, you need to be an expert on passing work off to other programs... [snip] If you took the Zen of Python, and pretty much reversed everything, you might have the Zen of Bash: I have to

Re: Opinion on best practice...

2013-02-07 Thread Steven D'Aprano
Chris Angelico wrote: On Thu, Feb 7, 2013 at 5:50 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 07 Feb 2013 16:28:17 +1100, Chris Angelico wrote: You misunderstand. It's actually a very simple rule. Python follows C's principle of accepting that any return value

Re: Opinion on best practice...

2013-02-07 Thread Steven D'Aprano
Dennis Lee Bieber wrote: Line 3 has unquoted echo which is not a REXX command; it is considered an external command and is passed the /result/ of calling REXX time() -- where Windows executes it Good lord, that's even worse than I feared. So it's not just unparsable non-REXX code that is

Re: Opinion on best practice...

2013-02-06 Thread Anssi Saari
Dennis Lee Bieber wlfr...@ix.netcom.com writes: PowerShell is meant to be used for administrative level scripting, replacing such things as WSH. Yeah and WSH has been included since Windows 98... So Windows has been at least OK with shell scripting VBScript and JScript for the last 15

Re: Opinion on best practice...

2013-02-06 Thread Neil Cerutti
On 2013-02-05, Grant Edwards invalid@invalid.invalid wrote: On 2013-02-05, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but it's silly to use

Re: Opinion on best practice...

2013-02-06 Thread Grant Edwards
On 2013-02-06, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Feb 5, 2013 at 3:59 PM, Grant Edwards invalid@invalid.invalid wrote: On 2013-02-05, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that

Re: Opinion on best practice...

2013-02-06 Thread Grant Edwards
On 2013-02-06, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Grant Edwards invalid@invalid.invalid wrote: On 2013-02-05, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for

Re: Opinion on best practice...

2013-02-06 Thread Grant Edwards
On 2013-02-06, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris Angelico wrote: Python is not an excellent option. It's a bad fit for shell scripting, it just happens to be way better than a weak shell. Having grown up on command.com, I found OS/2's cmd.exe to be a massive

Re: Opinion on best practice...

2013-02-06 Thread Steven D'Aprano
Dennis Lee Bieber wrote: On Wed, 6 Feb 2013 17:16:04 +1100, Chris Angelico ros...@gmail.com declaimed the following in gmane.comp.python.general: It feels silly enough translating this OS/2 batch script: @logon SOME_USER /pSOME_PASS /vl @e:\rexx\load @db2 start database manager @exit

Re: Opinion on best practice...

2013-02-06 Thread Chris Angelico
On Thu, Feb 7, 2013 at 10:46 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Dennis Lee Bieber wrote: Though that is the nice feature of REXX*... Anything that wasn't parsable as a REXX statement was automatically sent to the current command processor. Nice? Are you being

Re: Opinion on best practice...

2013-02-06 Thread Steven D'Aprano
On Thu, 07 Feb 2013 16:28:17 +1100, Chris Angelico wrote: On Thu, Feb 7, 2013 at 10:46 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Dennis Lee Bieber wrote: Though that is the nice feature of REXX*... Anything that wasn't parsable as a REXX statement was automatically sent

Re: Opinion on best practice...

2013-02-06 Thread Chris Angelico
On Thu, Feb 7, 2013 at 5:50 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 07 Feb 2013 16:28:17 +1100, Chris Angelico wrote: You misunderstand. It's actually a very simple rule. Python follows C's principle of accepting that any return value from an expression should

Re: Opinion on best practice...

2013-02-05 Thread Terry Reedy
On 2/4/2013 11:14 PM, Anthony Correia wrote: I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = (C:\\temp2)

Re: Opinion on best practice...

2013-02-05 Thread Ulrich Eckhardt
Am 05.02.2013 05:14, schrieb Anthony Correia: I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = (C:\\temp2) Drop

Re: Opinion on best practice...

2013-02-05 Thread Jean-Michel Pichavant
- Original Message - I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = (C:\\temp2) colDir =

Re: Opinion on best practice...

2013-02-05 Thread Peter Otten
Ulrich Eckhardt wrote: separate variable but iterated over it directly. For large dirs, it could also be better to use os.path.walk(), because that doesn't first build a list and then iterate over the list but iterates over the single elements directly. This avoids the memory allocation

Re: Opinion on best practice...

2013-02-05 Thread rusi
- Original Message - I need to pick up a language that would cover the Linux platform.  I use Powershell for a scripting language on the Windows side of things.  Very simple copy files script.  Is this the best way to do it? Have you seen/checked http://pash.sourceforge.net/ ?

Re: Opinion on best practice...

2013-02-05 Thread Ulrich Eckhardt
Am 05.02.2013 11:35, schrieb Peter Otten: Ulrich Eckhardt wrote: [...] use os.path.walk(), because that doesn't first build a list and then iterate over the list but iterates over the single elements directly. [...] Not true. os.walk() uses os.listdir() internally. Oh. 8| Thanks for

Re: Opinion on best practice...

2013-02-05 Thread Grant Edwards
On 2013-02-05, Anthony Correia akcorr...@gmail.com wrote: I need to pick up a language that would cover the Linux platform. Well, you haven't really described what it is you're trying to do, but it looks to me like bash and the usual set of shell utilities (e.g. find) is what you need rather

Re: Opinion on best practice...

2013-02-05 Thread Grant Edwards
On 2013-02-05, Terry Reedy tjre...@udel.edu wrote: On 2/4/2013 11:14 PM, Anthony Correia wrote: I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to

Re: Opinion on best practice...

2013-02-05 Thread Walter Hurry
On Tue, 05 Feb 2013 13:22:02 +, Grant Edwards wrote: On 2013-02-05, Anthony Correia akcorr...@gmail.com wrote: I need to pick up a language that would cover the Linux platform. Well, you haven't really described what it is you're trying to do, but it looks to me like bash and the

Re: Opinion on best practice...

2013-02-05 Thread Neil Cerutti
On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but it's silly to use Python (unless there is good reason) when a simple shell script will do the job. Python is an excellent option

Re: Opinion on best practice...

2013-02-05 Thread Ethan Furman
On 02/05/2013 01:39 PM, Neil Cerutti wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but it's silly to use Python (unless there is good reason) when a simple shell script will

Re: Opinion on best practice...

2013-02-05 Thread Grant Edwards
On 2013-02-05, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but it's silly to use Python (unless there is good reason) when a simple shell

Re: Opinion on best practice...

2013-02-05 Thread Grant Edwards
On 2013-02-05, Ethan Furman et...@stoneleaf.us wrote: On 02/05/2013 01:39 PM, Neil Cerutti wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but it's silly to use Python (unless

Re: Opinion on best practice...

2013-02-05 Thread Chris Angelico
On Wed, Feb 6, 2013 at 10:00 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-02-05, Ethan Furman et...@stoneleaf.us wrote: On 02/05/2013 01:39 PM, Neil Cerutti wrote: Python is an excellent option for writing shell scripts, particularly if your shell is cmd.exe. I believe having

Re: Opinion on best practice...

2013-02-05 Thread Ian Kelly
On Tue, Feb 5, 2013 at 3:59 PM, Grant Edwards invalid@invalid.invalid wrote: On 2013-02-05, Neil Cerutti ne...@norwich.edu wrote: On 2013-02-05, Walter Hurry walterhu...@lavabit.com wrote: Sorry, I'm a Linux guy. I have no clue what that means. Hooray for common sense! Python is great, but

Re: Opinion on best practice...

2013-02-05 Thread Steven D'Aprano
Chris Angelico wrote: Python is not an excellent option. It's a bad fit for shell scripting, it just happens to be way better than a weak shell. Having grown up on command.com, I found OS/2's cmd.exe to be a massive improvement, and Windows's cmd.exe to be rather less impressive... but both

Re: Opinion on best practice...

2013-02-05 Thread Dan Stromberg
On Feb 5, 2013 6:00 PM, Steven Dapos;Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris Angelico wrote: Python is not an excellent option. It's a bad fit for shell scripting, it just happens to be way better than a weak shell. Having grown up on command.com, I found OS/2's cmd.exe

Re: Opinion on best practice...

2013-02-05 Thread Nobody
On Tue, 05 Feb 2013 21:01:56 +, Walter Hurry wrote: Hooray for common sense! Python is great, but it's silly to use Python (unless there is good reason) when a simple shell script will do the job. A shell script is only the better option if (almost) the *only* thing the script needs to do

Re: Opinion on best practice...

2013-02-05 Thread Michael Torrie
On 02/05/2013 08:32 PM, Nobody wrote: A shell script is only the better option if (almost) the *only* thing the script needs to do is to execute commands. The moment you start trying to process data, it's time to put up with the verbosity of subprocess.Popen() so that you can use a

Re: Opinion on best practice...

2013-02-05 Thread Chris Angelico
On Wed, Feb 6, 2013 at 12:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris Angelico wrote: Python is not an excellent option. It's a bad fit for shell scripting, it just happens to be way better than a weak shell. Having grown up on command.com, I found OS/2's cmd.exe

Re: Opinion on best practice...

2013-02-05 Thread rusi
On Feb 6, 6:55 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: I would not hesitate to use Python, or some other high-level language like Ruby, over bash for anything non-trivial that I cared about. It might not be as terse and compact as a well-written bash script, but that's

Opinion on best practice...

2013-02-04 Thread Anthony Correia
I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = (C:\\temp2) colDir = os.listdir(objdir) for f in colDir:

Re: Opinion on best practice...

2013-02-04 Thread Michael Torrie
On 02/04/2013 09:14 PM, Anthony Correia wrote: I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = (C:\\temp2)