summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-12-18 11:06:25 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-12-18 11:06:25 (GMT)
commitf289ae6f01683689dfd07785c9617175b40aea91 (patch)
treedd9a6f78817fcedbd95db286188507cf21a52bc0 /Doc/library
parent621601a698a285a45231a6fd223db33566dcb842 (diff)
downloadcpython-f289ae6f01683689dfd07785c9617175b40aea91.zip
cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.gz
cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.bz2
Merged revisions 67818 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67818 | antoine.pitrou | 2008-12-17 01:38:28 +0100 (mer., 17 déc. 2008) | 3 lines Issue #2183: Simplify and optimize bytecode for list comprehensions. ........
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/dis.rst19
1 files changed, 15 insertions, 4 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 500b83f..ab06542 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -357,14 +357,25 @@ Miscellaneous opcodes.
address to jump to (which should be a ``FOR_ITER`` instruction).
-.. opcode:: SET_ADD ()
+.. opcode:: SET_ADD (i)
- Calls ``set.add(TOS1, TOS)``. Used to implement set comprehensions.
+ Calls ``set.add(TOS1[-i], TOS)``. Used to implement set comprehensions.
-.. opcode:: LIST_APPEND ()
+.. opcode:: LIST_APPEND (i)
- Calls ``list.append(TOS1, TOS)``. Used to implement list comprehensions.
+ Calls ``list.append(TOS[-i], TOS)``. Used to implement list comprehensions.
+
+
+.. opcode:: MAP_ADD (i)
+
+ Calls ``dict.setitem(TOS1[-i], TOS, TOS1)``. Used to implement dict
+ comprehensions.
+
+
+For all of the SET_ADD, LIST_APPEND and MAP_ADD instructions, while the
+added value or key/value pair is popped off, the container object remains on
+the stack so that it is available for further iterations of the loop.
.. opcode:: LOAD_LOCALS ()