Ahhh…. time to relax

17Nov08

Finally, exams are over.

I can’t say that I have been as focused as I was last year. I guess the novelty of studying psychology has worn off somewhat. In between frantic scribbles of essay questions I managed to learn a lot of Python by hacking fui. It was short enough for me to understand 90% of it (the stuff to do with accepting keyboard input still mystifies me). I took the time to improve some aspects of it and add a new invert selection functionality (-i, –invert) that selects all files except those provided as arguments.

I learnt:
-List comprehensions! They are more elegant than iterating with ‘for’ for small tasks
-how the os.path, shutil, and pickle modules work
-why scope matters. Adding variables to the global namespace didn’t seem like a big deal before, but now I can see how much of a headache it can possibly be in the long run
-what decorator functions do (they are interesting, but I am not sure where you would use them frequently)
-not directly Python-related, but I tapped into more of Vim’s capabilities this time instead of treating it as a basic editor.

It is a small program, fui. I have big dreams for it, but I doubt it will grow into a massively popular tool. A lot of people are quite comfortable with cp and mv to handle their handles. It’s been very satisfying to learn new Python concepts and try to use them to improve fui. (Improvement being a very subjective word…)

I still have a lot to learn. Object-oriented programming still stumps me. I understand the concept, but not the code in practice. Exception handling is also a big grey area for me–it seems like there’s so many possible errors one has to account for. I also read through the documentation for the optparse module, hoping I could replace fui’s argument handling with it. Unfortunately it is a very detailed and complex module made to handle a variety of arguments and understanding it is a headache.

All my fui work is on Bitbucket:

http://www.bitbucket.org/mentallaxative/fui2/overview/

The only thing which I’m truly guilty about is trying to shorten the lines of code as much as possible. Sometimes a longer bit of code is easier to understand and accomplishes the same task as a terse one-liner. That’s another thing I have to learn–to not excessively tamper with what works. 🙂

Advertisements


%d bloggers like this: