Thursday, May 03, 2007
Python
Ack!! Okay, I'm learning more Python. I have to admit, it seems fast to write, and the code is more brief. Or maybe more clean. It's notably different looking from Perl.
I've been at it for less than three weeks and have already been able to write a Notification class and have almost finished a DBnc (named-column database) class. Very soon I should have a fully functioning HostDB class (which I just finished writing in Perl last week). With those in hand a production host monitoring script in Python should be ready, maybe today. Again, I just finished the Perl version of it last week.
I feel like I know most of the core of the language but there are some subtleties I'm still not clear on which will probably jump up and grab me at some point. I'm not sure I understand the difference in double- and single-quotes around strings. I'm not sure the meaning is the same as in Perl (or ksh).
I also have the logging and csv libraries pretty well in hand, now, along with mapping dictionaries (which are like Perl hashes). Handling command line args, file I/O, and regular expressions are working in my code.
I'm also trying to figure out how to write class modules, particularly in the area of comments in the code, author fields and such, and I need an expression to pull the CVS version number into the version field.
I've started using the three-double-quote comments/documentation in class and method definitions but I'm not sure how much decorating and such I can do---another thing I need to check into. I want to draw borders around the comments to set them off, using underlines and verticle bars, but I wonder if any tools want to reformat that text.
Learning how to use the setup.py code to install and how to make a distributable package are next on my list. I've already done a couple of installs (and found out you need to apt-get install phython2.4-dev or whatever version you are using, for setup to work correctly).
I've been able to learn almost everything from the Tutorial and the Library Reference. I did spend 20 to 30 minutes in a bookstore reading some of the O'Reilly book at one point (while waiting on the customer service desk to find a reserved book). I've gone searching on Google for the answers to a couple of questions but typically the trail led back to the above two documents.
An any event, I'm having fun with it.