From a52226cd70b58e686f3d48d360956602458ef38e Mon Sep 17 00:00:00 2001 From: rasbt Date: Wed, 16 Jul 2014 17:41:08 -0400 Subject: [PATCH] small wording change in closure-section --- tutorials/not_so_obvious_python_stuff.ipynb | 55 +++++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/tutorials/not_so_obvious_python_stuff.ipynb b/tutorials/not_so_obvious_python_stuff.ipynb index c2e2948..a3188b0 100644 --- a/tutorials/not_so_obvious_python_stuff.ipynb +++ b/tutorials/not_so_obvious_python_stuff.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d87105a74c8f25016f90bdec495a890a988277a3f51e0589febbbac87720b033" + "signature": "sha256:5dd675ee714d0dbd00f7be378f1379f4dceaa728c56476124c1bf493d70c569e" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,18 +13,60 @@ "metadata": {}, "source": [ "[Sebastian Raschka](http://sebastianraschka.com) \n", - "last updated: 05/24/2014 ([Changelog](#changelog))\n", "\n", "- [Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/tutorials/not_so_obvious_python_stuff.ipynb) \n", "- [Link to the GitHub repository](https://github.com/rasbt/python_reference) \n", "\n" ] }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%load_ext watermark" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%watermark -d -u -v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Last updated: 16/07/2014 \n", + "\n", + "CPython 3.4.1\n", + "IPython 2.0.0\n" + ] + } + ], + "prompt_number": 2 + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "#### All code was executed in Python 3.4 (unless stated otherwise)" + "[More information](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/ipython_magic/watermark.ipynb) about the `watermark` magic command extension.\n", + "\n", + "([Changelog](#changelog))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
\n", + "
" ] }, { @@ -1013,7 +1055,7 @@ "\n", "(Original source: [http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html](http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html))\n", "\n", - "In the first example below, we call a `lambda` function in a list comprehension, and the value `i` will be dereferenced every time we call `lambda` within the scope of the list comprehension. Since the list is already constructed when we `for-loop` through the list, it will be set to the last value 4." + "In the first example below, we call a `lambda` function in a list comprehension, and the value `i` will be dereferenced every time we call `lambda` within the scope of the list comprehension. Since the list comprehension has already been constructed and evaluated when we for-loop through the list, the closure-variable will be set to the last value 4." ] }, { @@ -1045,7 +1087,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This, however, does not apply to generators:" + "However, by using a generator expression, we can make use of its stepwise evaluation (note that the returned variable still stems from the same closure, but the value changes as we iterate over the generator)." ] }, { @@ -4281,6 +4323,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "#### 07/16/2014\n", + "- slight change of wording in the [lambda-closure section](#lambda_closure)\n", + "\n", "#### 05/24/2014\n", "- new section: unorderable types in Python 2\n", "- table of contents for the Python 2 vs. Python 3 topic\n",