Skip to content

Commit a52226c

Browse files
committed
small wording change in closure-section
1 parent 936c755 commit a52226c

File tree

1 file changed

+50
-5
lines changed

1 file changed

+50
-5
lines changed

tutorials/not_so_obvious_python_stuff.ipynb

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:d87105a74c8f25016f90bdec495a890a988277a3f51e0589febbbac87720b033"
4+
"signature": "sha256:5dd675ee714d0dbd00f7be378f1379f4dceaa728c56476124c1bf493d70c569e"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -13,18 +13,60 @@
1313
"metadata": {},
1414
"source": [
1515
"[Sebastian Raschka](http://sebastianraschka.com) \n",
16-
"last updated: 05/24/2014 ([Changelog](#changelog))\n",
1716
"\n",
1817
"- [Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/tutorials/not_so_obvious_python_stuff.ipynb) \n",
1918
"- [Link to the GitHub repository](https://github.com/rasbt/python_reference) \n",
2019
"\n"
2120
]
2221
},
22+
{
23+
"cell_type": "code",
24+
"collapsed": false,
25+
"input": [
26+
"%load_ext watermark"
27+
],
28+
"language": "python",
29+
"metadata": {},
30+
"outputs": [],
31+
"prompt_number": 1
32+
},
33+
{
34+
"cell_type": "code",
35+
"collapsed": false,
36+
"input": [
37+
"%watermark -d -u -v"
38+
],
39+
"language": "python",
40+
"metadata": {},
41+
"outputs": [
42+
{
43+
"output_type": "stream",
44+
"stream": "stdout",
45+
"text": [
46+
"Last updated: 16/07/2014 \n",
47+
"\n",
48+
"CPython 3.4.1\n",
49+
"IPython 2.0.0\n"
50+
]
51+
}
52+
],
53+
"prompt_number": 2
54+
},
2355
{
2456
"cell_type": "markdown",
2557
"metadata": {},
2658
"source": [
27-
"#### All code was executed in Python 3.4 (unless stated otherwise)"
59+
"<font size=\"1.5em\">[More information](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/ipython_magic/watermark.ipynb) about the `watermark` magic command extension.</font>\n",
60+
"\n",
61+
"([Changelog](#changelog))"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"<br>\n",
69+
"<br>"
2870
]
2971
},
3072
{
@@ -1013,7 +1055,7 @@
10131055
"\n",
10141056
"(Original source: [http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html](http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html))\n",
10151057
"\n",
1016-
"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."
1058+
"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."
10171059
]
10181060
},
10191061
{
@@ -1045,7 +1087,7 @@
10451087
"cell_type": "markdown",
10461088
"metadata": {},
10471089
"source": [
1048-
"This, however, does not apply to generators:"
1090+
"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)."
10491091
]
10501092
},
10511093
{
@@ -4281,6 +4323,9 @@
42814323
"cell_type": "markdown",
42824324
"metadata": {},
42834325
"source": [
4326+
"#### 07/16/2014\n",
4327+
"- slight change of wording in the [lambda-closure section](#lambda_closure)\n",
4328+
"\n",
42844329
"#### 05/24/2014\n",
42854330
"- new section: unorderable types in Python 2\n",
42864331
"- table of contents for the Python 2 vs. Python 3 topic\n",

0 commit comments

Comments
 (0)