| This is kind of awesome. "Sys admin" type usage definitely drives adoption/popularity/usage of a language (e.g., see perl; and people like doing sysadmin stuff with ruby). I would love, love to have something close to pythonpy in the python core. The absence of being able to cleanly fit into standard UNIX pipe / 'filter' type workflows is a real downer for python for me and for others trying to do "sys admin" workflows. If you were to invent a time machine and put something close to this (pythonpy) in core python ~15 years ago, then I literally think python would be more popular today (and even maybe chef and/or puppet might have been written in python. That said, rewinding time and playing it forward is a bit challenging, so I suppose we'll never know. ;-) One-liners play a big role in sysadmin type usage. I'm not a sysadmin, but I have to frequently hop on different boxes to see what the heck is going on. Typical use might be something like "whoa, lot of files here... how many the heck files are there?", which is answered with a simple 'wc -l', but then you start asking other question like "how many big files" and "what's the average file size", etc., etc., and you start putting together longer one liners chaining together sed and awk and gawk and sh and bash and perl (including to pick up a convenient modern regex engine, which awk is not), etc., and doing it all in an extremely fast iterative run/press up arrow a few times/edit/run cycle... but for me, even though I like python, only very rarely do I use a python one-liner. In general, some one liners sometimes grow, and then grow some more, and then some graduate to a script that then graduates to a full-fledged project. Python sometimes effectively gets eliminated from the running for a project at step 0. I like using the right language for the job, and have no problem using multiple languages on a large or medium sized project... but it slows me down and causes me some mental agita to use 2-3 languages on a tiny project like a one liner (where I'm counting mini-languages like awk/sed here). I'd love to use python as my default "go to language" for one liners... This project (pythonpy) and other projects help, but really for me good support for python one liners needs to be in the core default python so that when I hop on some random box to troubleshoot something for one of many teams, that capability is there waiting for me (and the absence of that "just being there waiting" is what killed my usage of my own version of a simple "improved one-liner support for python" package; our environment was too diverse and too often in practice it ended up being faster for me to use perl or ___, rather than going through the hurdle of installing a python module, which in some cases is more or less frowned upon for production boxes). Based on a quick initial review, pythonpy looks better than some of the alternative efforts. Love the tab completion! |
Take me for instance: I know a couple of programming laguages pretty well and know how to do most of the typical awk/sed/grep/... functionality in them by hart. I don't do a lot of command line work though, and never came around to learning it properly, so when I do and have to do something like 'move all files if some condition is true'/'do x for files containing y' and so on it's always the same struggle - couple of options:
- start googling around till solution found using awk/sed/... crawl through sometimes awkward syntax and require multiple dummy runs or on copies od data (not nice if it's in the TB ranges) to make sure I don't screw something up
- once and for all learn the ins and outs of awk/sed/...; not sure if the amount of time I'd have to spend on it is worth it
- start an IDE, write some C++ or C#, enter debugger and fix things on the go until correct. The process is usually way faster than the above one since I know syntax and needed methods by hart
- write Python/MsBuild script
- use something like pythonpy
Usually any of these except the first two seem a better idea in my case. So next time I'm definitely going to try the last one out.