[pypy-commit] pypy default: Document slice assignment and deletion for RPython lists.

arigo noreply at buildbot.pypy.org
Sun Nov 20 15:57:45 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49577:c665226786f8
Date: 2011-11-20 15:57 +0100
http://bitbucket.org/pypy/pypy/changeset/c665226786f8/

Log:	Document slice assignment and deletion for RPython lists.

diff --git a/pypy/doc/coding-guide.rst b/pypy/doc/coding-guide.rst
--- a/pypy/doc/coding-guide.rst
+++ b/pypy/doc/coding-guide.rst
@@ -270,7 +270,12 @@
   - *slicing*:
     the slice start must be within bounds. The stop doesn't need to, but it must
     not be smaller than the start.  All negative indexes are disallowed, except for
-    the [:-1] special case.  No step.
+    the [:-1] special case.  No step.  Slice deletion follows the same rules.
+    
+  - *slice assignment*:
+    only supports ``lst[x:y] = sublist``, if ``len(sublist) == y - x``.
+    In other words, slice assignment cannot change the total length of the list,
+    but just replace items.
 
   - *other operators*:
     ``+``, ``+=``, ``in``, ``*``, ``*=``, ``==``, ``!=`` work as expected.


More information about the pypy-commit mailing list