mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-23 20:11:13 +00:00
cheatsheet upd
This commit is contained in:
commit
3dcb205363
BIN
Images/ipython_links_remedy2.png
Normal file
BIN
Images/ipython_links_remedy2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -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)"
|
||||
"<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",
|
||||
"\n",
|
||||
"([Changelog](#changelog))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<br>\n",
|
||||
"<br>"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -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",
|
||||
|
|
|
@ -29,7 +29,7 @@ _\-- written by Sebastian Raschka_ on March 7, 2014
|
|||
• Conclusion
|
||||
|
||||
The complete Python code that I am using in this tutorial can be downloaded
|
||||
from my GitHub repository: [https://github.com/rasbt/python_reference/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tutorials/sqlite3_howto)
|
||||
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)
|
||||
|
||||
|
||||
* * *
|
||||
|
@ -97,7 +97,7 @@ there is more information about PRIMARY KEYs further down in this section).
|
|||
|
||||
|
||||
|
||||
mport sqlite3
|
||||
import sqlite3
|
||||
|
||||
sqlite_file = 'my_first_db.sqlite' # name of the sqlite database file
|
||||
table_name1 = 'my_table_1' # name of the table to be created
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:ba20b7e6666952b09ad936f7b9cb32fc0e9ed680a00aeff02035be51895c8e45"
|
||||
"signature": "sha256:34307c4f0973ebef511e97c036657231fc4e230e7627cfe073d89f4046f9ce9f"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
@ -13,10 +13,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"[Sebastian Raschka](http://sebastianraschka.com) \n",
|
||||
"last updated: 05/18/2014\n",
|
||||
"\n",
|
||||
"- [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",
|
||||
"- [Link to the GitHub Repository One-Python-benchmark-per-day](https://github.com/rasbt/One-Python-benchmark-per-day)\n"
|
||||
"last updated: 05/29/2014"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -215,6 +212,15 @@
|
|||
"\n",
|
||||
"<br>\n",
|
||||
"<br>\n",
|
||||
"\n",
|
||||
"### Solution 2: line break between the id-anchor and text:\n",
|
||||
"\n",
|
||||
"![img of format problem](https://raw.githubusercontent.com/rasbt/python_reference/master/Images/ipython_links_remedy2.png)\n",
|
||||
"\n",
|
||||
"(this alternative workaround was kindly submitted by [Ryan Morshead](https://github.com/rmorshea))\n",
|
||||
"\n",
|
||||
"<br>\n",
|
||||
"<br>\n",
|
||||
"<br>\n",
|
||||
"<hr>"
|
||||
]
|
||||
|
@ -223,7 +229,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Solution 2: using header cells"
|
||||
"### Solution 3: using header cells"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user