Partially Applied classes with __new__
Python’s got some pretty cool ways to enable unorthodox behavior. For my project, I’ve found myself writing a lot of closures around our existing class init functions, and have decided it might be easier & more consistent to express this as what it really is: partial application.
Partial application is pretty simple to enable for python class constructors, since the separate new method allows you to construct closures around initialization routines.
Since embedding math & code directly has been a pain on Tumblr recently, I’ll just link to the example notebook and (eventually) move this blog to gh-pages.
imported from: yetanothergeographer