My lightning talk from EuroPython 2014.
View Slide
# -*- coding: utf-8 -*-
from __future__ import (division,print_function,absolute_import,unicode_literals)
class DocumentForm(forms.Form):def __init__(self, *args, **kwargs):super(DocumentForm, self).__init__(*args, **kwargs)# do stuff...class IndexView(TemplateView):def get_context_data(self, **kwargs):data = super(IndexView, self).get_context_data(**kwargs)data["foo"] = "bar"return data
def lazy_id_collector():yield from ItemA.objects.values("id")yield from ItemB.objects.values("id")yield from ItemC.objects.values("id")
import faulthandlerfaulthandler.enable()
pip install mockfrom mock import patchfrom unittest.mock import patch