Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cb8ecb14
Commit
cb8ecb14
authored
Sep 04, 2007
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc update for __xslice__ removal.
parent
4a7b5d5b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
147 deletions
+57
-147
Doc/library/constants.rst
Doc/library/constants.rst
+2
-3
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+6
-7
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+43
-130
Doc/reference/expressions.rst
Doc/reference/expressions.rst
+6
-7
No files found.
Doc/library/constants.rst
View file @
cb8ecb14
...
...
@@ -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, ...]
Doc/library/stdtypes.rst
View file @
cb8ecb14
...
...
@@ -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
s
upports no s
pecial 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 ``...``.
...
...
Doc/reference/datamodel.rst
View file @
cb8ecb14
This diff is collapsed.
Click to expand it.
Doc/reference/expressions.rst
View file @
cb8ecb14
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment