Skip to content

Instantly share code, notes, and snippets.

@medwards
Created January 24, 2013 17:42
Show Gist options
  • Save medwards/4625606 to your computer and use it in GitHub Desktop.
Save medwards/4625606 to your computer and use it in GitHub Desktop.
Trying to extract a dependency
def add_foos(stuff):
for thing in stuff:
thing['foo'] = float(thing['id']) * 2.0
return stuff
class ConnectorThing(object):
result_enricher = add_foos
def get_results(self):
# do something
bar = [{'id': 1}, {'id': 2}, {'id': 3}]
bar = self.result_enricher(bar)
ConnectorThing.get_results()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment