Decorators as composable abstractions
Authors | Sidhant Godiwala |
Talk Type | talk |
Level | Intermediate |
Topic | Core Python (including Python 3.x) |
Tags | decorators, abstractions, design patterns |
"Higher order" functions are functions which take functions as arguments, return functions as results or both. They can be used to create very powerful yet completely composable abstractions.
Decorators are syntactic sugar for creating higher order functions in Python and I'm going to show you how you can use them to introduce a new level of succinctness into your code.
In 2010, at Clojure Conj, Mark McGranaghan gave a talk on composable abstractions in Clojure, using his Ring framework as an example.
I was very impressed with Ring, and Mark's talk resonated with my view on how programming could be.
At InfinitelyBeta (in production) we have a framework for implementing libraries for REST APIs which makes exhaustive use of decorators and results in code that is both flexible and readable.
My talk will use a subset of this framework as an example to illustrate the concept of composable abstractions
I will cover the following,
- A basic introduction to higher order functions
- An overview of decorators and types of decorators
- A description of the problem (multiple custom REST libraries)
- A solution to the problem using decorators
- Show running code
- Bringing it all together with composable abstractions
- QnA
Software developer at Infinitely Beta. Enjoys functional programming and building to scale. Also a hobbyist game developer.
blog - http://blog.sidhantgodiwala.in/ github - http://github.com/grinnbearit/ hackernews handle - grinnbearit
file | size | uploaded | comment |
---|---|---|---|
Decorators_as_Composable_Abstractions.pdf | 92.8 KB | August 31, 2011 |
You can upload or delete a file if you are author of this talk.