Skip to content

Commit ff938c4

Browse files
committed
a is b oddity explained
1 parent 96f7d72 commit ff938c4

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

.ipynb_checkpoints/not_so_obvious_python_stuff-checkpoint.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:437ca0df14a08cf4fd584f91122010286928f287ae14c5ac1ce8230abe9dbf9a"
4+
"signature": "sha256:43a74f5daf674621e35388775c4372dd9587ddf80df1e26c2c8301ae66424581"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -13,7 +13,9 @@
1313
"metadata": {},
1414
"source": [
1515
"Sebastian Raschka \n",
16-
"last updated: 04/15/2014"
16+
"last updated: 04/15/2014\n",
17+
"\n",
18+
"[Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/not_so_obvious_python_stuff.ipynb)"
1719
]
1820
},
1921
{
@@ -38,7 +40,7 @@
3840
"- [The C3 class resolution algorithm for multiple class inheritance](#c3_class_res)\n",
3941
"- [The behavior of += for lists](#pm_in_lists)\n",
4042
"- [`True` and `False` in the datetime module](#datetime_module)\n",
41-
"- [Some Python Oddity that I cannot explain, yet](#python_oddity)\n",
43+
"- [Python reuses objects for small integers](#python_small_int)\n",
4244
"- [Shallow vs. deep copies if list contains other structures and objects](#shallow_vs_deep)\n",
4345
"- [Picking True values from and and or expressions](#false_true_expressions)"
4446
]
@@ -186,8 +188,10 @@
186188
"source": [
187189
"<br>\n",
188190
"<br>\n",
189-
"<a name='python_oddity'></a>\n",
190-
"## Some Python Oddity that I cannot explain, yet"
191+
"<a name='python_small_int'></a>\n",
192+
"## Python reuses objects for small integers \n",
193+
"\n",
194+
"This oddity occurs, because Python tends to stores small integers as the same object, but not so for larger ones!"
191195
]
192196
},
193197
{

not_so_obvious_python_stuff.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:466467169d92398c710c1b7969b363ee4c4d32dcf96afa519dd8fb9162785cc4"
4+
"signature": "sha256:43a74f5daf674621e35388775c4372dd9587ddf80df1e26c2c8301ae66424581"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -40,7 +40,7 @@
4040
"- [The C3 class resolution algorithm for multiple class inheritance](#c3_class_res)\n",
4141
"- [The behavior of += for lists](#pm_in_lists)\n",
4242
"- [`True` and `False` in the datetime module](#datetime_module)\n",
43-
"- [Some Python Oddity that I cannot explain, yet](#python_oddity)\n",
43+
"- [Python reuses objects for small integers](#python_small_int)\n",
4444
"- [Shallow vs. deep copies if list contains other structures and objects](#shallow_vs_deep)\n",
4545
"- [Picking True values from and and or expressions](#false_true_expressions)"
4646
]
@@ -188,8 +188,10 @@
188188
"source": [
189189
"<br>\n",
190190
"<br>\n",
191-
"<a name='python_oddity'></a>\n",
192-
"## Some Python Oddity that I cannot explain, yet"
191+
"<a name='python_small_int'></a>\n",
192+
"## Python reuses objects for small integers \n",
193+
"\n",
194+
"This oddity occurs, because Python tends to stores small integers as the same object, but not so for larger ones!"
193195
]
194196
},
195197
{

0 commit comments

Comments
 (0)