Hi, I'm Daniel Greenfeld, and welcome to my blog. I write about Python, Django, and much more.

cached-property: Don't copy/paste code

Tuesday, July 01, 2014 (permalink)

In Python, the @cached_property decorator is a really nice piece of code. What it does is it caches the result of a property call. The cached result will persist as long as the instance does, so if the instance is passed around and the function subsequently invoked, the cached result ...

Read more ...

Cookiecutter: Project Templates Made Easy

Saturday, August 17, 2013 (permalink)

Yesterday, Jeff Knupp wrote an amazing how-to article called "Open Sourcing a Python Project the Right Way". While I was reading it, I was rather pleased by just how close it is to my own practices. Considering Jeff's amazing Writing Idiomatic Python, it meant I was on the right ...

Read more ...

Made Up Statistics

Friday, July 26, 2013 (permalink)

Years ago my good friend Miguel Araujo and I presented on Advanced Django Form Usage. Slide 18 of that talk mentioned some made up statistics. Here they are for reference:

  • 91% of Django projects use ModelForms.
  • 80% ModelForms require trivial logic.
  • 20% ModelForms require complex logic.

In Chapter 10 of ...

Read more ...