Commit cb8ecb14 authored by Georg Brandl's avatar Georg Brandl

Doc update for __xslice__ removal.

parent 4a7b5d5b
......@@ -34,7 +34,6 @@ A small number of constants live in the built-in namespace. They are:
.. data:: Ellipsis
The same as ``...``. Special value used mostly in conjunction with extended
slicing syntax for user-defined container data types.
.. % XXX Someone who understands extended slicing should fill in here.
slicing syntax for user-defined container data types, as in ::
val = container[1:5, 7:10, ...]
......@@ -587,7 +587,6 @@ of the same type and have the same length. (For full details see
pair: repetition; operation
pair: subscript; operation
pair: slice; operation
pair: extended slice; operation
operator: in
operator: not in
......@@ -948,9 +947,10 @@ the :mod:`re` module for string functions based on regular expressions.
.. method:: str.translate(map)
Return a copy of the *s* where all characters have been mapped through the
*map* which must be a mapping of Unicode ordinals (integers) to Unicode
ordinals, strings or ``None``. Unmapped characters are left
untouched. Characters mapped to ``None`` are deleted.
*map* which must be a dictionary of characters (strings of length 1) or
Unicode ordinals (integers) to Unicode ordinals, strings or ``None``.
Unmapped characters are left untouched. Characters mapped to ``None`` are
deleted.
.. note::
......@@ -1244,7 +1244,6 @@ Note that while lists allow their items to be of any type, bytes object
triple: operations on; list; type
pair: subscript; assignment
pair: slice; assignment
pair: extended slice; assignment
statement: del
single: append() (sequence method)
single: extend() (sequence method)
......@@ -2389,8 +2388,8 @@ It is written as ``None``.
The Ellipsis Object
-------------------
This object is mostly used by extended slice notation (see :ref:`slicings`). It
supports no special operations. There is exactly one ellipsis object, named
This object is commonly used by slicing (see :ref:`slicings`). It supports no
special operations. There is exactly one ellipsis object, named
:const:`Ellipsis` (a built-in name).
It is written as ``Ellipsis`` or ``...``.
......
This diff is collapsed.
......@@ -517,25 +517,24 @@ or list). Slicings may be used as expressions or as targets in assignment or
simple_slicing: `primary` "[" `short_slice` "]"
extended_slicing: `primary` "[" `slice_list` "]"
slice_list: `slice_item` ("," `slice_item`)* [","]
slice_item: `expression` | `proper_slice` | `ellipsis`
slice_item: `expression` | `proper_slice`
proper_slice: `short_slice` | `long_slice`
short_slice: [`lower_bound`] ":" [`upper_bound`]
long_slice: `short_slice` ":" [`stride`]
lower_bound: `expression`
upper_bound: `expression`
stride: `expression`
ellipsis: "..."
.. index:: pair: extended; slicing
There is ambiguity in the formal syntax here: anything that looks like an
expression list also looks like a slice list, so any subscription can be
interpreted as a slicing. Rather than further complicating the syntax, this is
disambiguated by defining that in this case the interpretation as a subscription
takes priority over the interpretation as a slicing (this is the case if the
slice list contains no proper slice nor ellipses). Similarly, when the slice
list has exactly one short slice and no trailing comma, the interpretation as a
simple slicing takes priority over that as an extended slicing.
slice list contains no proper slice). Similarly, when the slice list has
exactly one short slice and no trailing comma, the interpretation as a simple
slicing takes priority over that as an extended slicing.
.. XXX is the next paragraph stil correct?
The semantics for a simple slicing are as follows. The primary must evaluate to
a sequence object. The lower and upper bound expressions, if present, must
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment