Less bad
The theme of last Java lecture was “Linked Lists: Because Arrays Really, Really Suck.” Hey, I now understand how Python lists (with their indifference to the datatypes stored in them) must be implemented. Cool.
And that’s how things have been going in class; I pick up little jigsaw-puzzle pieces and fit them into my limited understanding of how programming works. I completely blew the last pop quiz because I hadn’t memorized my sort algorithms, but that’s okay—I’ll have ’em before next week’s midterm, and who cares about the grade anyway?
Big-O analysis isn’t something I’m ever going to do on a regular basis, but learning about it has already changed how I approach some problems. I’m putting together an immense (well, for me; a big repository would laugh at what I consider “immense”) batch import into the repository; to make my life easier, I’m going to write a little Python haxie to stash all the files into appropriate directories by filename (since that happens to work with this bunch).
Some of the papers have both a PDF and PostScript file; obviously I’m archiving both files in the same item. (If PDF changes past recognition, my guess is I’ll have much better luck re-distilling from PostScript than doing a PDF-to-PDF conversion. One day in the life of a repository manager; we worry about these things.) So I can’t just run down the file list and indiscriminately make a folder per filename; I have to check whether the folder’s been made already.
In the old days, I would have taken the easy way out and kept a running list of already-made folders. if filename in madeFolders: #use the existing folder But that’s awful from a Big-O standpoint; the program has to run through the entire madeFolders list for every file. Besides, the filename list will be sorted, so there’s no need to check against an entire madeFolders list—just keep track of the last file processed, and if its filename (minus extension) is the same as the current file’s, there’s a folder already, so stick the current file in it.
It’s a little thing, admittedly. But it’s a little thing that makes me a slightly less bad programmer than I was, so I’ll take it.