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
97ea1164
Commit
97ea1164
authored
Jun 30, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documented the pop() method for lists.
# The brackets generated by \optional{} are real ugly. Alas...
parent
9c59ce9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Doc/lib/libtypes.tex
Doc/lib/libtypes.tex
+9
-4
No files found.
Doc/lib/libtypes.tex
View file @
97ea1164
...
...
@@ -460,17 +460,19 @@ The following operations are defined on mutable sequence types (where
\lineiii
{
\var
{
s
}
.append(
\var
{
x
}
)
}
{
same as
\code
{
\var
{
s
}
[len(
\var
{
s
}
):len(
\var
{
s
}
)] = [
\var
{
x
}
]
}}{}
\lineiii
{
\var
{
s
}
.count(
\var
{
x
}
)
}
{
return number of
\var
{
i
}
's for which
\code
{
\var
{
s
}
[
\var
{
i
}
] ==
\var
{
x
}}}{}
{
return number of
\var
{
i
}
's for which
\code
{
\var
{
s
}
[
\var
{
i
}
] ==
\var
{
x
}}}{}
\lineiii
{
\var
{
s
}
.index(
\var
{
x
}
)
}
{
return smallest
\var
{
i
}
such that
\code
{
\var
{
s
}
[
\var
{
i
}
] ==
\var
{
x
}}}{
(1)
}
{
return smallest
\var
{
i
}
such that
\code
{
\var
{
s
}
[
\var
{
i
}
] ==
\var
{
x
}}}{
(1)
}
\lineiii
{
\var
{
s
}
.insert(
\var
{
i
}
,
\var
{
x
}
)
}
{
same as
\code
{
\var
{
s
}
[
\var
{
i
}
:
\var
{
i
}
] = [
\var
{
x
}
]
}
if
\code
{
\var
{
i
}
>= 0
}}{}
\lineiii
{
\var
{
s
}
.pop(
\optional
{
\var
{
i
}}
)
}
{
same as
\code
{
x =
\var
{
s
}
[
\var
{
i
}
]; del
\var
{
s
}
[
\var
{
i
}
]; return x
}}{
(4)
}
\lineiii
{
\var
{
s
}
.remove(
\var
{
x
}
)
}
{
same as
\code
{
del
\var
{
s
}
[
\var
{
s
}
.index(
\var
{
x
}
)]
}}{
(1)
}
\lineiii
{
\var
{
s
}
.reverse()
}
{
reverses the items of
\var
{
s
}
in place
}{
(3)
}
\lineiii
{
\var
{
s
}
.sort()
}
\lineiii
{
\var
{
s
}
.sort(
\var
{
cmpfunc
}
)
}
{
sort the items of
\var
{
s
}
in place
}{
(2), (3)
}
\end{tableiii}
\indexiv
{
operations on
}{
mutable
}{
sequence
}{
types
}
...
...
@@ -508,6 +510,9 @@ list in place for economy of space when sorting or reversing a large
list. They don't return the sorted or reversed list to remind you of
this side effect.
\item
[(4)4]
The optional argument
\var
{
i
}
defaults to
\code
{
-1
}
, so that
by default the last item is removed and returned.
\end{description}
...
...
@@ -849,7 +854,7 @@ object's (writable) attributes;
\item
\code
{
\var
{
x
}
.
__
methods
__}
lists the methods of many built-in object types,
e.g.,
\code
{
[].
__
methods
__}
yields
\code
{
['append', 'count', 'index', 'insert', 'remove', 'reverse', 'sort']
}
;
\code
{
['append', 'count', 'index', 'insert', '
pop', '
remove', 'reverse', 'sort']
}
;
\item
\code
{
\var
{
x
}
.
__
members
__}
lists data attributes;
...
...
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