Archive for October, 2009
Dependency Injection in Python
07Oct09
For testability reasons, we’ve begun using a lot of dependency injection in our Python projects. Imagine that I have a function that does some work and then ultimately calls an API over-the-wire: import simplejson from google.appengine.api import urlfetch # App Engine example def my_method(user_id): url = ‘http://www.example.com/lookup-user/%d.json’ % user_id result = urlfetch.fetch(url) if result.status_code == [...]
Filed under: Uncategorized | Leave a Comment
Tags: Projects, VendAsta