Python Quote module

Over the past couple of years I’ve been wanting to learn Python more seriously but really haven’t sat down and just done it.   I’ve written a couple of various scripts for personal and work use but always felt they weren’t coded in a “pythonic” way.  I’m now reading Learning Python (4th edition) from the beginning and making sure I learn things properly from the ground up.  When I was writing my code in the past I wasn’t aware of what objects were immutable vs mutable or how generators worked.  I basically knew what I wanted to accomplish before writing my code and would reference the online documentation and just go at it.  Overtime I picked up on some “pythonic” methods from looking at code examples, for example, using optparse for handling arguments passed into your program.

My first project I decided to tackle as I go through my book is writing a module that will fetch stock quotes from Yahoo’s Finance page and store them in memcached.  I just pushed it out to github available @  I’m hoping to get some feedback from some people on where I can improve in my code and hopefully it will be useful to someone else out there.  As I go through the book I plan on going back and looking at the code and see what I can refactor and I’m sure along the way I’ll probably re-architect things.

One thing I know I need to do is write some unit tests for the module.   When I was in my Computer Science program in college, we really never had any exposure to unit tests.  The unit tests consisted of assert statements and really never had any real lessons on them.  I need to do more reading on unittest.  I know many developers write their unit tests first before writing a single line of code in a test driven development approach.  It’s something I want to look at more and see if I should consider picking that up.

Also as part of this coding project, it was a good excuse to get some exercise with Git.  It’s pretty easy to work with and I haven’t even scratched the surface of its potential.  I just need to begin looking at some of its more advanced features and incorporating them into my work flow.

Vim is another program I’m getting some finger exercise in.  When I started my job 3 years ago I had never really opened Vim/Vi but one day forced myself to learn it because as a sysadmin, Vi will always be there for you, like your friend Stewie.  In my day to day uses of Vi, I just used the basics, hjkl and :wq.  Slowly I picked up some commands from co-workers and got used to using them daily.  When writing code in Vim , there are a lot of tricks and commands to aide you in writing code , I’ve read about many but now it’s a matter of incorporating them so I don’t have to think much and breaking my old habits to use the new commands I’ve read about.