Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
12bba852
Kaydet (Commit)
12bba852
authored
Agu 24, 2000
tarafından
Thomas Wouters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rough and incomplete documentation on augmented assignment, which follows
shortly. Markup also needs checking.
üst
b0b7e317
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
4 deletions
+70
-4
libdis.tex
Doc/lib/libdis.tex
+59
-0
ref2.tex
Doc/ref/ref2.tex
+4
-0
ref3.tex
Doc/ref/ref3.tex
+7
-4
No files found.
Doc/lib/libdis.tex
Dosyayı görüntüle @
12bba852
...
...
@@ -130,6 +130,11 @@ Lifts second and third stack item one position up, moves top down
to position three.
\end{opcodedesc}
\begin{opcodedesc}
{
ROT
_
FOUR
}{}
Lifts second, third and forth stack item one position up, moves top down to
position four.
\end{opcodedesc}
\begin{opcodedesc}
{
DUP
_
TOP
}{}
Duplicates the reference on top of the stack.
\end{opcodedesc}
...
...
@@ -209,6 +214,55 @@ Implements \code{TOS = TOS1 \^\ TOS}.
Implements
\code
{
TOS = TOS1 | TOS
}
.
\end{opcodedesc}
In-place operations are like binary operations, in that they remove TOS and
TOS1, and push the result back on the stack, but the operation is done
in-place when TOS1 supports it, and the resulting TOS may be (but does not
have to be) the original TOS1.
\begin{opcodedesc}
{
INPLACE
_
POWER
}{}
Implements in-place
\code
{
TOS = TOS1 ** TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
MULTIPLY
}{}
Implements in-place
\code
{
TOS = TOS1 * TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
DIVIDE
}{}
Implements in-place
\code
{
TOS = TOS1 / TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
MODULO
}{}
Implements in-place
\code
{
TOS = TOS1
\%
{}
TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
ADD
}{}
Implements in-place
\code
{
TOS = TOS1 + TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
SUBTRACT
}{}
Implements in-place
\code
{
TOS = TOS1 - TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
LSHIFT
}{}
Implements in-place
\code
{
TOS = TOS1 << TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
RSHIFT
}{}
Implements in-place
\code
{
TOS = TOS1 >> TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
AND
}{}
Implements in-place
\code
{
TOS = TOS1
\&\
TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
XOR
}{}
Implements in-place
\code
{
TOS = TOS1
\^\
TOS
}
.
\end{opcodedesc}
\begin{opcodedesc}
{
INPLACE
_
OR
}{}
Implements in-place
\code
{
TOS = TOS1 | TOS
}
.
\end{opcodedesc}
The slice opcodes take up to three parameters.
\begin{opcodedesc}
{
SLICE+0
}{}
...
...
@@ -366,6 +420,11 @@ the stack right-to-left.
%This opcode is obsolete.
%\end{opcodedesc}
\begin{opcodedesc}
{
DUP
_
TOPX
}{
count
}
Duplicate
\var
{
count
}
items, keeping them in the same order. Due to
implementation limits,
\var
{
count
}
should be between 1 and 5 inclusive.
\end{opcodedesc}
\begin{opcodedesc}
{
STORE
_
ATTR
}{
namei
}
Implements
\code
{
TOS.name = TOS1
}
, where
\var
{
namei
}
is the index
of name in
\member
{
co
_
names
}
.
...
...
Doc/ref/ref2.tex
Dosyayı görüntüle @
12bba852
...
...
@@ -523,10 +523,14 @@ The following tokens serve as delimiters in the grammar:
\begin{verbatim}
( ) [ ]
{
}
, : . ` = ;
+= -= *= /=
%= **=
&
= |=
^
= >>= <<=
\end{verbatim}
The period can also occur in floating-point and imaginary literals. A
sequence of three periods has a special meaning as an ellipsis in slices.
The second half of the list, the augmented assignment operators, serve
lexically as delimiters, but also perform an operation.
The following printing ASCII characters have special meaning as part
of other tokens or are otherwise significant to the lexical analyzer:
...
...
Doc/ref/ref3.tex
Dosyayı görüntüle @
12bba852
...
...
@@ -1054,9 +1054,10 @@ methods \method{append()}, \method{count()}, \method{index()},
and
\method
{
sort()
}
, like Python standard list objects. Finally,
sequence types should implement addition (meaning concatenation) and
multiplication (meaning repetition) by defining the methods
\method
{__
add
__
()
}
,
\method
{__
radd
__
()
}
,
\method
{__
mul
__
()
}
and
\method
{__
rmul
__
()
}
described below; they should not define
\method
{__
coerce
__
()
}
or other numerical operators.
\method
{__
add
__
()
}
,
\method
{__
radd
__
()
}
,
\method
{__
iadd
__
()
}
,
\method
{__
mul
__
()
}
,
\method
{__
rmul
__
()
}
and
\method
{__
imul
__
()
}
described
below; they should not define
\method
{__
coerce
__
()
}
or other numerical
operators.
\withsubitem
{
(mapping object method)
}{
\ttindex
{
keys()
}
\ttindex
{
values()
}
...
...
@@ -1077,8 +1078,10 @@ multiplication (meaning repetition) by defining the methods
\ttindex
{
sort()
}
\ttindex
{__
add
__
()
}
\ttindex
{__
radd
__
()
}
\ttindex
{__
iadd
__
()
}
\ttindex
{__
mul
__
()
}
\ttindex
{__
rmul
__
()
}}
\ttindex
{__
rmul
__
()
}
\ttindex
{__
imul
__
()
}}
\withsubitem
{
(numeric object method)
}{
\ttindex
{__
coerce
__
()
}}
\begin{methoddesc}
[mapping object]
{__
len
__}{
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