'indent'ing Python in windows bat

David Smith davids at invtools.com
Tue Sep 18 09:03:19 EDT 2012


Thank you all. Roy Smith gets the most thanks, though he didn't answer 
my general question -- he showed me how to look at that specific 
structure differently. Terry Reedy might get thanks for her idea if I 
can ever figure the correct escape sequences that will make both windows 
and the Python interpreter happy. Bat makes bash/sed combos look like a 
breeze...

I thought you guys wouldn't want a treatise about WHY I was doing it 
this way and left it at one sentence. For whatever record, this is the 
sentence most missed.
> I'm converting windows bat files little by little to Python 3 as I find time and learn Python.

I COULD stop doing all my other work to learn Python and convert all the 
batch files in one fell swoop. Efficiency? Fast way to get fired. Better 
to fit this in during the many small breaks I have. That's how the bat 
files were built over time in the first place. Or this email.

I COULD break down each batch file and write dozens of mini python 
scripts to be called. I already have a few, too. Efficiency? Speed is 
bad, but these are bat files, after all. The cost of trying to work with 
a multitude of small files is high, though, and I realized I had better 
go to a mix.

Some sections can be broken down to one liners. Efficiency? Speed is 
terrible, but it's far faster than typing commands. OTOH, I have the 
organization I need on the original bat file, which is slowly being 
rem'ed out. As I learn and have the time, the one-liners will melt 
together into a py file to be called from the bat file. Eventually, the 
bat will disappear back into the broken Window from whence it came.

Ugly, eh? I have under my belt scads of different languages from Fortran 
(using JCL!), Pascal, C++ to bash, sed, awk to Forth, assembly and a 
large cast of others. No big deal. My brain and Python, however, do NOT 
mix. I have been trying to learn the thing for over a decade and figure 
this will either force my brain into seeing the heart of the beast, or 
be swallowed in the attempt.

Bat files are ugly cripples, but even on Windows a two-legged quick and 
dirty dog is better than mistake-prone typing and button clicking. After 
conversion, I'm aiming to make these erstwhile ugly cripples fly when I 
find the time and as I stuff more Python down my gullet.

I agree. For those who have the unbroken time and understanding of 
Python, this is idiotic.

back to work,



More information about the Python-list mailing list