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
d7b86d90
Commit
d7b86d90
authored
Sep 07, 2015
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #23406: Merge 3.4 into 3.5
parents
0ad584c7
146794b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
Doc/faq/programming.rst
Doc/faq/programming.rst
+2
-0
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+9
-6
Misc/ACKS
Misc/ACKS
+1
-0
No files found.
Doc/faq/programming.rst
View file @
d7b86d90
...
...
@@ -1164,6 +1164,8 @@ analogue of lisp car is ``lisp_list[0]`` and the analogue of cdr is
usually a lot slower than using Python lists.
.. _faq-multidimensional-list:
How do I create a multidimensional list?
----------------------------------------
...
...
Doc/library/stdtypes.rst
View file @
d7b86d90
...
...
@@ -854,8 +854,8 @@ operations have the same priority as the corresponding numeric operations.
| ``s + t`` | the concatenation of *s* and | (6)(7) |
| | *t* | |
+--------------------------+--------------------------------+----------+
| ``s * n`` or |
*n* shallow copies of *s*
| (2)(7) |
| ``n * s`` |
concatenated
| |
| ``s * n`` or |
equivalent to adding *s* to
| (2)(7) |
| ``n * s`` |
itself *n* times
| |
+--------------------------+--------------------------------+----------+
| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) |
+--------------------------+--------------------------------+----------+
...
...
@@ -897,9 +897,9 @@ Notes:
(2)
Values of *n* less than ``0`` are treated as ``0`` (which yields an empty
sequence of the same type as *s*). Note
also that the copies are shallow;
nested structures are not copied. This often haunts new Python programmers;
consider::
sequence of the same type as *s*). Note
that items in the sequence *s*
are not copied; they are referenced multiple times. This often haunts
new Python programmers;
consider::
>>> lists = [[]] * 3
>>> lists
...
...
@@ -909,7 +909,7 @@ Notes:
[[3], [3], [3]]
What has happened is that ``[[]]`` is a one-element list containing an empty
list, so all three elements of ``[[]] * 3`` are
(pointers to)
this single empty
list, so all three elements of ``[[]] * 3`` are
references to
this single empty
list. Modifying any of the elements of ``lists`` modifies this single list.
You can create a list of different lists this way::
...
...
@@ -920,6 +920,9 @@ Notes:
>>> lists
[[3], [5], [7]]
Further explanation is available in the FAQ entry
:ref:`faq-multidimensional-list`.
(3)
If *i* or *j* is negative, the index is relative to the end of the string:
``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is
...
...
Misc/ACKS
View file @
d7b86d90
...
...
@@ -1127,6 +1127,7 @@ Martin Pool
Iustin Pop
Claudiu Popa
John Popplewell
Matheus Vieira Portela
Davin Potts
Guillaume Pratte
Florian Preinstorfer
...
...
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