Mocking in Python

An Introduction to Mocking in Python by Naftuli Tzvi Kay

This article is very insightful for covering mocking in Python.  In case you don’t know mocking is a technique for testing where you don’t want to use a particular object or set of objects.  For example, you might want to simulate database functionality while you are writing your test cases.

Hope you all find this useful, have a great day!



Interesting Tips for Python

I am teaching myself Python. Initially looking at Python, I thought this language is a joke. No curly braces, no end statements, just indentation? REALLY?! No explicit declarations of variables, come on.

But being a patient person, I am giving it a good try. There are some good things about it, after all Google uses it for a lot of their development, as does Youtube. Python has some really nice functional aspects to it (ie. tuples, lists, map reduce/filter) and it is relatively fast for an interpretted language.


It has some decent unicode support. One thing that is rather interesting if you want to compare a unicode string with an ASCII string, it will evaluate to true. For example:

>>> s = ‘hello’
>>> u = u’hello’
>>> s == u

Google has a great class that is free for the public if you are interested in. Going through it at your own pace is wonderful, great for a beginner to Python. It was actually developed for their own employees. Thank you Google for providing some great content for the public!!! Yes, that’s right a MS fanboy is praising Google for something, it’s that good! Found below here:

Testing Python Modules

Here is something interesting, modules are objects. This is really, really cool because you can access attributes for the module. So why does this get me excited. Because it allows for some great testing of the functions. It makes test driven development very easy. At the end of your script you can test your code just by running the module. Once the module passes the tests you have set up, the module is ready to be used in another module. This is accomplished like this:

if __name__ == ‘__main__’:
<test statements here>

Free Programming Books For Python

E-Books Galore!

I found a great blog that has 10 free ebooks on Python, including one on TKinter. I can’t wait to tear into them, hopefully you will get some use from them too!

The link to Dive Into Python does not work, but this one does. Dive Into Python

Python Tutorials

If you are really starting from scratch, here is my list of good Python tutorials:

Please let me know if you have any good resources to share!

Python Introduction ~ How to become a Python Programmer

I am starting to teach myself Python and if you are reading this, then you might be learning it to. Good for you! Its a fun language, mainly because of it’s minimal syntax, sorry Perl! I am going to share my resources with you right here. If I missed something that you found useful, let me know I will be happy to post it and I could use the help too!

An interesting note, Python is actually named after Monty Python, not the snake.

Where to download Python:

The official Python website:

START HERE!!!! Google’s Python course (Open Courseware):
I recommend going through the entire course and do the exercises. The exercises really will help you get the hang of it! It is a full blown course, video lectures, reading material, and assignments.

GUI programming with Python, Perl, and Ruby using TK (who doesn’t want to make a GUI):

The offical documentation:

It is really nice and easy to get the hang of. After two weekends, I can actually do some really cool things. URLLib is an awesome module, I know why Google loves it so much!

A couple tips for starting out:

  • Don’t forget the colons after control blocks of code (for, while, if, else, elif, etc.)
  • Careful naming of your variables, will save you from making poor mistakes.
  • Test your software frequently, in your main function, have all your test cases for your functions. Make sure your code is solid before continuing on to the next function!

I want to hear from, any tips and tricks are welcome.