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
dc90cc2b
Commit
dc90cc2b
authored
Dec 11, 2000
by
Thomas Wouters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional docs for __iadd__ and family, closing SF bug #117178 and SF patch
#102169.
parent
2a22200a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
Doc/ref/ref3.tex
Doc/ref/ref3.tex
+26
-0
No files found.
Doc/ref/ref3.tex
View file @
dc90cc2b
...
...
@@ -1293,6 +1293,32 @@ try calling \method{__rpow__()} (the coercion rules would become too
complicated).
\end{methoddesc}
\begin{methoddesc}
[numeric object]
{__
iadd
__}{
self, other
}
\methodline
[numeric object]
{__
isub
__}{
self, other
}
\methodline
[numeric object]
{__
imul
__}{
self, other
}
\methodline
[numeric object]
{__
idiv
__}{
self, other
}
\methodline
[numeric object]
{__
imod
__}{
self, other
}
\methodline
[numeric object]
{__
ipow
__}{
self, other
\optional
{
, modulo
}}
\methodline
[numeric object]
{__
ilshift
__}{
self, other
}
\methodline
[numeric object]
{__
irshift
__}{
self, other
}
\methodline
[numeric object]
{__
iand
__}{
self, other
}
\methodline
[numeric object]
{__
ixor
__}{
self, other
}
\methodline
[numeric object]
{__
ior
__}{
self, other
}
These methods are called to implement the augmented arithmetic operations
(
\code
{
+=
}
,
\code
{
-=
}
,
\code
{
*=
}
,
\code
{
/=
}
,
\code
{
\%
=
}
,
\code
{
**=
}
,
\code
{
<<=
}
,
\code
{
>>=
}
,
\code
{
\&
=
}
,
\code
{
\^
=
}
,
\code
{
|=
}
). These methods
should attempt to do the operation in-place (modifying
\var
{
self
}
) and
return the result (which could be, but does not have to be,
\var
{
self
}
). If
a specific method is not defined, the augmented operation falls back to the
normal methods. For instance, to evaluate the expression
\var
{
x
}
\code
{
+=
}
\var
{
y
}
, where
\var
{
x
}
is an instance of a class that has an
\method
{__
iadd
__
()
}
method,
\code
{
\var
{
x
}
.
__
iadd
__
(
\var
{
y
}
)
}
is called. If
\var
{
x
}
is an instance of a class that does not define a
\method
{__
iadd()
}
method,
\code
{
\var
{
x
}
.
__
add
__
(
\var
{
y
}
)
}
and
\code
{
\var
{
y
}
.
__
radd
__
(
\var
{
x
}
)
}
are considered, as with the evaluation of
\var
{
x
}
\code
{
+
}
\var
{
y
}
.
\end{methoddesc}
\begin{methoddesc}
[numeric object]
{__
neg
__}{
self
}
\methodline
[numeric object]
{__
pos
__}{
self
}
\methodline
[numeric object]
{__
abs
__}{
self
}
...
...
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