Friday, June 19, 2009

Learning python

I think I like Python very much...

I spent several days reading book about 2hrs a day, and wrote small script which reads database, prepares report, generates html content and sends this content as an email message (both html and text version, for old/specific clients).

The script is scheduled with the CRON and it just worked. So, i think this is really good result for the language you don't know.
  1. understand execution model
  2. incorporate database querying support (with named parameters, yeah :)
  3. understand how to generate html (I'm using jaxml module, it's kinda cool. creating html document just looks like doc.html().body(color="red").p(string, align="center") )
  4. understand how to send e-mail message (yes, mime knowledge gives good help, but neretheless. I'm sending this through GMAIL - so, SSL support is also here)
  5. understand how to work with dates (that's a bit ugly now, I'm sure there's better way of obtaining today timestamp than time.mktime( )
All this, resulting in a working solution, took for me about 6-7 hrs from the start. Without language knowledge at all :) : )

Learn python!