"* [Appendix: Functions are not special](#appendix-functions-are-not-special)\n",
"* [Appendix: Closures](#appendix-closures)\n",
"* [Appendix: Decorators without arguments versus decorators with arguments](#appendix-decorators-without-arguments-versus-decorators-with-arguments)\n",
"* [Understanding decorators in 12 easy steps](http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/)\n",
"* [The decorators they won't tell you about](https://github.com/hchasestevens/hchasestevens.github.io/blob/master/notebooks/the-decorators-they-wont-tell-you-about.ipynb)\n",
"* [Closures - Wikipedia][wiki-closure]\n",
"* [Closures in Python](https://www.geeksforgeeks.org/python-closures/)\n",
...
...
%% Cell type:markdown id: tags:
# Decorators
Remember that in Python, everything is an object, including functions. This
means that we can do things like:
- Pass a function as an argument to another function.
- Create/define a function inside another function.
- Write a function which returns another function.
These abilities mean that we can do some neat things with functions in Python.
*[Overview](#overview)
*[Decorators on methods](#decorators-on-methods)
*[Example - memoization](#example-memoization)
*[Decorators with arguments](#decorators-with-arguments)
*[Chaining decorators](#chaining-decorators)
*[Decorator classes](#decorator-classes)
*[Appendix: Functions are not special](#appendix-functions-are-not-special)
*[Appendix: Closures](#appendix-closures)
*[Appendix: Decorators without arguments versus decorators with arguments](#appendix-decorators-without-arguments-versus-decorators-with-arguments)
*[Understanding decorators in 12 easy steps](http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/)
*[The decorators they won't tell you about](https://github.com/hchasestevens/hchasestevens.github.io/blob/master/notebooks/the-decorators-they-wont-tell-you-about.ipynb)
*[Closures - Wikipedia][wiki-closure]
*[Closures in Python](https://www.geeksforgeeks.org/python-closures/)
*[Garbage collection in Python](https://www.quora.com/How-does-garbage-collection-in-Python-work-What-are-the-pros-and-cons)
*[Understanding decorators in 12 easy steps](http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/)
*[The decorators they won't tell you about](https://github.com/hchasestevens/hchasestevens.github.io/blob/master/notebooks/the-decorators-they-wont-tell-you-about.ipynb)
*[Closures - Wikipedia][wiki-closure]
*[Closures in Python](https://www.geeksforgeeks.org/python-closures/)