immutable tuple upd.

This commit is contained in:
rasbt 2014-04-15 21:31:40 -04:00
parent f3844ea83b
commit 69b2774301

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:29a120258e2d108ed5eace08e071ad866ae379b4f24fde804401ee858a2090fb"
"signature": "sha256:5f8052b5458fbe30e4066fd51688157e823dbbcce9f2e4ef402acfc6af40d046"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -985,7 +985,7 @@
"\n",
"**A. Jesse Jiryu Davis** has a nice explanation for this phenomenon (Original source: [http://emptysqua.re/blog/python-increment-is-weird-part-ii/](http://emptysqua.re/blog/python-increment-is-weird-part-ii/))\n",
"\n",
"If we try to extend the list via `+=` *\"then the statement executes STORE_SUBSCR, which calls the C function PyObject_SetItem, which checks if the object supports item assignment. In our case the object is a tuple, so PyObject_SetItem throws the TypeError. Mystery solved.\"*"
"If we try to extend the list via `+=` *\"then the statement executes `STORE_SUBSCR`, which calls the C function `PyObject_SetItem`, which checks if the object supports item assignment. In our case the object is a tuple, so `PyObject_SetItem` throws the `TypeError`. Mystery solved.\"*"
]
},
{