Skip to content

Commit 3dcb205

Browse files
committed
cheatsheet upd
2 parents 4b34d71 + 4beb09c commit 3dcb205

4 files changed

Lines changed: 64 additions & 13 deletions

File tree

Images/ipython_links_remedy2.png

10.3 KB
Loading

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",

tutorials/sqlite3_howto/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _\-- written by Sebastian Raschka_ on March 7, 2014
2929
• Conclusion
3030

3131
The complete Python code that I am using in this tutorial can be downloaded
32-
from my GitHub repository: [https://github.com/rasbt/python_reference/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tutorials/sqlite3_howto)
32+
from my GitHub repository: [https://github.com/rasbt/python_reference/tree/master/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tree/master/tutorials/sqlite3_howto)
3333

3434

3535
* * *
@@ -97,7 +97,7 @@ there is more information about PRIMARY KEYs further down in this section).
9797

9898

9999

100-
mport sqlite3
100+
import sqlite3
101101

102102
sqlite_file = 'my_first_db.sqlite' # name of the sqlite database file
103103
table_name1 = 'my_table_1' # name of the table to be created

tutorials/table_of_contents_ipython.ipynb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:ba20b7e6666952b09ad936f7b9cb32fc0e9ed680a00aeff02035be51895c8e45"
4+
"signature": "sha256:34307c4f0973ebef511e97c036657231fc4e230e7627cfe073d89f4046f9ce9f"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -13,10 +13,7 @@
1313
"metadata": {},
1414
"source": [
1515
"[Sebastian Raschka](http://sebastianraschka.com) \n",
16-
"last updated: 05/18/2014\n",
17-
"\n",
18-
"- [Link to this IPython notebook on Github](https://github.com/rasbt/One-Python-benchmark-per-day/blob/master/ipython_nbs/day4_2_cython_numba_parakeet.ipynb) \n",
19-
"- [Link to the GitHub Repository One-Python-benchmark-per-day](https://github.com/rasbt/One-Python-benchmark-per-day)\n"
16+
"last updated: 05/29/2014"
2017
]
2118
},
2219
{
@@ -215,6 +212,15 @@
215212
"\n",
216213
"<br>\n",
217214
"<br>\n",
215+
"\n",
216+
"### Solution 2: line break between the id-anchor and text:\n",
217+
"\n",
218+
"![img of format problem](https://raw.githubusercontent.com/rasbt/python_reference/master/Images/ipython_links_remedy2.png)\n",
219+
"\n",
220+
"(this alternative workaround was kindly submitted by [Ryan Morshead](https://github.com/rmorshea))\n",
221+
"\n",
222+
"<br>\n",
223+
"<br>\n",
218224
"<br>\n",
219225
"<hr>"
220226
]
@@ -223,7 +229,7 @@
223229
"cell_type": "markdown",
224230
"metadata": {},
225231
"source": [
226-
"### Solution 2: using header cells"
232+
"### Solution 3: using header cells"
227233
]
228234
},
229235
{

0 commit comments

Comments
 (0)