My old '66 Plymouth Fury got horrible gas mileage. A sleek luxury boat of a car, Mopar gold, it was a pleasure to drive. It was also so simple I could do my own work on it. The 318's 8-cylinder simplicity lurked under the hood. Had I started with a more modern car, I wouldn't have learned half of what I did. I am no car mechanic, but thanks to fiddling with my Fury, I understand the basic working principles of what is under the hood. In a pinch, I could fix minor problems.
I like programs I can work on too. I don't like black boxes. While I have rarely dug into the source of very large programs, I like being able to crack open the box and see how it works inside. Though I am inquisitive by nature, I admit to feeling intimidated by large, mature programs. The code seems packed in there like the myriad gizmos of a Toyota Prius. It's more than I can cram into my head at one time. I recognize some of it, but only because I am familiar with simpler programs, tools written in languages I know. A few simple Python tools I have been using recently are lfm, sliceTime, and pybook.
Back when most of my work was done at a DOS prompt, I was a big fan of Norton Commander. A simple full screen interface made it easy to tag and move groups of files. Often using wildcards would be faster, but sometimes wildcards just wouldn't do. With Norton Commander, you had both at your fingertips. On my Linux system, I have Midnight Commander, a Norton Commander clone. I like it, but even simpler still is Iñigo Serna's lfm.
Written in about 100k of well-documented python, the Last File Manager, lfm, is a console application. Serna uses the curses library to create this Midnight Commander-like file manager. The command keys are identical to MC so if you are an old hand at Norton or MC, you can use this application right away. lfm does not have a command prompt at the bottom of the screen the way Norton and MC do. Nor are all of its commands implemented yet. If like me you think using Python tools is fun, you won't let that stop you.
There are several time tracking tools available on Linux. Gnome comes with a fine one called GTimeTracker. The code for it is not so daunting, but simpler still is Andrei Kulakov's sliceTime. You run this command line program once to start tracking a project and again to stop tracking it. It saves project information in text files. It is under a thousand lines long.
Kulakov has also given us pybook, a command prompt interface between vim and the Gutenberg project. Using ftp, it retrieves books from ibiblio.org and displays them in vim. It tracks what books you have read, and keeps a bookmark of where you are in each book. I like the way Kulakov uses Python as the coordinating glue between a destop application and an online service. In another project, Scribbler, he does something similar glueing vim and lynx, creating a diary program.
These programs are short and clear enough that even novice programmers can tweak them to fit their needs. With the simplicity of Python programming, you could give sliceTime a GUI face lift, add functions to lfm, or adapt pybooks to work with a different editor or viewer. You can learn from tearing them apart and putting them back together again. Best of all, these tools do something. They aren't just book examples. While invoking them isn't anything like driving my old Fury, I love knowing how they work.
Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.
Read more Python News columns.
Return to the Python DevCenter.
Copyright © 2017 O'Reilly Media, Inc.