ch02: created notebook

This commit is contained in:
Luciano Ramalho 2019-04-06 11:34:18 -03:00
parent 0e53341809
commit b1fbf30f0d
4 changed files with 2221 additions and 4 deletions

View File

@ -6,7 +6,7 @@
"source": [ "source": [
"# Chapter 1 — The Python Data Model\n", "# Chapter 1 — The Python Data Model\n",
"\n", "\n",
"**Sections with examples:**\n", "**Sections code snippets in this chapter:**\n",
"\n", "\n",
"* [A Pythonic Card Deck](#A-Pythonic-Card-Deck)\n", "* [A Pythonic Card Deck](#A-Pythonic-Card-Deck)\n",
"* [Emulating Numeric Types](#Emulating-Numeric-Types)" "* [Emulating Numeric Types](#Emulating-Numeric-Types)"
@ -23,7 +23,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Example 1-1. A deck as a sequence of playing cards" "#### Example 1-1. A deck as a sequence of playing cards"
] ]
}, },
{ {
@ -140,7 +140,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Card(rank='2', suit='hearts')" "Card(rank='Q', suit='clubs')"
] ]
}, },
"execution_count": 6, "execution_count": 6,
@ -463,7 +463,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Example 1-2. A simple two-dimensional vector class" "#### Example 1-2. A simple two-dimensional vector class"
] ]
}, },
{ {

3
02-array-seq/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
floats-*.txt
floats-*.npy
floats.bin

2203
02-array-seq/array-seq.ipynb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
Assigning to Slices
===================
An example that raises an error::
>>> l = list(range(10))
>>> l[2:5] = 100
Traceback (most recent call last):
...
TypeError: can only assign an iterable