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
61ed4db9
Kaydet (Commit)
61ed4db9
authored
Ara 06, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added section for operator module (compiled Skip Montanaro).
üst
ccaf3b6d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
389 additions
and
1 deletion
+389
-1
Makefile
Doc/Makefile
+1
-1
lib.tex
Doc/lib.tex
+1
-0
lib.tex
Doc/lib/lib.tex
+1
-0
liboperator.tex
Doc/lib/liboperator.tex
+193
-0
liboperator.tex
Doc/liboperator.tex
+193
-0
No files found.
Doc/Makefile
Dosyayı görüntüle @
61ed4db9
...
...
@@ -112,7 +112,7 @@ LIBFILES = lib.tex \
libcd.tex libfl.tex libfm.tex libgl.tex libimgfile.tex libsun.tex
\
libxdrlib.tex libimghdr.tex
\
librestricted.tex librexec.tex libbastion.tex
\
libformatter.tex
libformatter.tex
liboperator.tex
# Library document
lib.dvi
:
$(LIBFILES)
...
...
Doc/lib.tex
Dosyayı görüntüle @
61ed4db9
...
...
@@ -77,6 +77,7 @@ to Python and how to embed it in other applications.
\input
{
libpython
}
% Python Services
\input
{
libsys
}
\input
{
libtypes2
}
% types is already taken :-(
\input
{
liboperator
}
\input
{
libtraceback
}
\input
{
libpickle
}
\input
{
libshelve
}
...
...
Doc/lib/lib.tex
Dosyayı görüntüle @
61ed4db9
...
...
@@ -77,6 +77,7 @@ to Python and how to embed it in other applications.
\input
{
libpython
}
% Python Services
\input
{
libsys
}
\input
{
libtypes2
}
% types is already taken :-(
\input
{
liboperator
}
\input
{
libtraceback
}
\input
{
libpickle
}
\input
{
libshelve
}
...
...
Doc/lib/liboperator.tex
0 → 100644
Dosyayı görüntüle @
61ed4db9
% Contributed by Skip Montanaro, from the module's doc strings.
\section
{
Built-in Module
\sectcode
{
operator
}}
% If implemented in C
\bimodindex
{
spam
}
The
\code
{
operator
}
module exports a set of functions implemented in C
corresponding to the intrinsic operators of Python. For example,
{}
\code
{
operator.add(x, y)
}
is equivalent to the expression x+y. The
function names are those used for special class methods; variants without
leading and trailing '
\_\_
' are also provided for convenience.
The
\code
{
operator
}
module defines the following functions:
\renewcommand
{
\indexsubitem
}{
(in module operator)
}
\begin{funcdesc}
{
add
}{
a
\,
b
}
Return a + b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
add
\_\_
}{
a
\,
b
}
Return a + b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
sub
}{
a
\,
b
}
Return a - b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
sub
\_\_
}{
a
\,
b
}
Return a - b.
\end{funcdesc}
\begin{funcdesc}
{
mul
}{
a
\,
b
}
Return a * b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
mul
\_\_
}{
a
\,
b
}
Return a * b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
div
}{
a
\,
b
}
Return a / b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
div
\_\_
}{
a
\,
b
}
Return a / b.
\end{funcdesc}
\begin{funcdesc}
{
mod
}{
a
\,
b
}
Return a
\%
b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
mod
\_\_
}{
a
\,
b
}
Return a
\%
b.
\end{funcdesc}
\begin{funcdesc}
{
neg
}{
o
}
Return o negated.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
neg
\_\_
}{
o
}
Return o negated.
\end{funcdesc}
\begin{funcdesc}
{
pos
}{
o
}
Return o positive.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
pos
\_\_
}{
o
}
Return o positive.
\end{funcdesc}
\begin{funcdesc}
{
abs
}{
o
}
Return the absolute value of o.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
abs
\_\_
}{
o
}
Return the absolute value of o.
\end{funcdesc}
\begin{funcdesc}
{
inv
}{
o
}
Return the inverse of o.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
inv
\_\_
}{
o
}
Return the inverse of o.
\end{funcdesc}
\begin{funcdesc}
{
lshift
}{
a
\,
b
}
Return a shifted left by b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
lshift
\_\_
}{
a
\,
b
}
Return a shifted left by b.
\end{funcdesc}
\begin{funcdesc}
{
rshift
}{
a
\,
b
}
Return a shifted right by b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
rshift
\_\_
}{
a
\,
b
}
Return a shifted right by b.
\end{funcdesc}
\begin{funcdesc}
{
and
\_
}{
a
\,
b
}
Return the bitwise and of a and b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
and
\_\_
}{
a
\,
b
}
Return the bitwise and of a and b.
\end{funcdesc}
\begin{funcdesc}
{
or
\_
}{
a
\,
b
}
Return the bitwise or of a and b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
or
\_\_
}{
a
\,
b
}
Return the bitwise or of a and b.
\end{funcdesc}
\begin{funcdesc}
{
concat
}{
a
\,
b
}
Return a + b for a and b sequences.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
concat
\_\_
}{
a
\,
b
}
Return a + b for a and b sequences.
\end{funcdesc}
\begin{funcdesc}
{
repeat
}{
a
\,
b
}
Return a * b where a is a sequence and b is an integer.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
repeat
\_\_
}{
a
\,
b
}
Return a * b where a is a sequence and b is an integer.
\end{funcdesc}
\begin{funcdesc}
{
getitem
}{
a
\,
b
}
Return the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
getitem
\_\_
}{
a
\,
b
}
Return the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
setitem
}{
a
\,
b
\,
c
}
Set the value of a at index b to c.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
setitem
\_\_
}{
a
\,
b
\,
c
}
Set the value of a at index b to c.
\end{funcdesc}
\begin{funcdesc}
{
delitem
}{
a
\,
b
}
Set the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
delitem
\_\_
}{
a
\,
b
}
Set the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
getslice
}{
a
\,
b
\,
c
}
Return the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
getslice
\_\_
}{
a
\,
b
\,
c
}
Return the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
setslice
}{
a
\,
b
\,
c
\,
v
}
Set the slice of a from index b to index c-1 to the sequence v.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
setslice
\_\_
}{
a
\,
b
\,
c
\,
v
}
Set the slice of a from index b to index c-1 to the sequence v.
\end{funcdesc}
\begin{funcdesc}
{
delslice
}{
a
\,
b
\,
c
}
Delete the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
delslice
\_\_
}{
a
\,
b
\,
c
}
Delete the slice of a from index b to index c-1.
\end{funcdesc}
Example: Build a dictionary that maps the ordinals from 0 to 256 to their
character equivalents.
\begin{verbatim}
>>> import operator
>>> d =
{}
>>> keys = range(256)
>>> vals = map(chr, keys)
>>> map(operator.setitem, [d]*len(keys), keys, vals)
\end{verbatim}
Doc/liboperator.tex
0 → 100644
Dosyayı görüntüle @
61ed4db9
% Contributed by Skip Montanaro, from the module's doc strings.
\section
{
Built-in Module
\sectcode
{
operator
}}
% If implemented in C
\bimodindex
{
spam
}
The
\code
{
operator
}
module exports a set of functions implemented in C
corresponding to the intrinsic operators of Python. For example,
{}
\code
{
operator.add(x, y)
}
is equivalent to the expression x+y. The
function names are those used for special class methods; variants without
leading and trailing '
\_\_
' are also provided for convenience.
The
\code
{
operator
}
module defines the following functions:
\renewcommand
{
\indexsubitem
}{
(in module operator)
}
\begin{funcdesc}
{
add
}{
a
\,
b
}
Return a + b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
add
\_\_
}{
a
\,
b
}
Return a + b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
sub
}{
a
\,
b
}
Return a - b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
sub
\_\_
}{
a
\,
b
}
Return a - b.
\end{funcdesc}
\begin{funcdesc}
{
mul
}{
a
\,
b
}
Return a * b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
mul
\_\_
}{
a
\,
b
}
Return a * b, for a and b numbers.
\end{funcdesc}
\begin{funcdesc}
{
div
}{
a
\,
b
}
Return a / b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
div
\_\_
}{
a
\,
b
}
Return a / b.
\end{funcdesc}
\begin{funcdesc}
{
mod
}{
a
\,
b
}
Return a
\%
b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
mod
\_\_
}{
a
\,
b
}
Return a
\%
b.
\end{funcdesc}
\begin{funcdesc}
{
neg
}{
o
}
Return o negated.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
neg
\_\_
}{
o
}
Return o negated.
\end{funcdesc}
\begin{funcdesc}
{
pos
}{
o
}
Return o positive.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
pos
\_\_
}{
o
}
Return o positive.
\end{funcdesc}
\begin{funcdesc}
{
abs
}{
o
}
Return the absolute value of o.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
abs
\_\_
}{
o
}
Return the absolute value of o.
\end{funcdesc}
\begin{funcdesc}
{
inv
}{
o
}
Return the inverse of o.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
inv
\_\_
}{
o
}
Return the inverse of o.
\end{funcdesc}
\begin{funcdesc}
{
lshift
}{
a
\,
b
}
Return a shifted left by b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
lshift
\_\_
}{
a
\,
b
}
Return a shifted left by b.
\end{funcdesc}
\begin{funcdesc}
{
rshift
}{
a
\,
b
}
Return a shifted right by b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
rshift
\_\_
}{
a
\,
b
}
Return a shifted right by b.
\end{funcdesc}
\begin{funcdesc}
{
and
\_
}{
a
\,
b
}
Return the bitwise and of a and b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
and
\_\_
}{
a
\,
b
}
Return the bitwise and of a and b.
\end{funcdesc}
\begin{funcdesc}
{
or
\_
}{
a
\,
b
}
Return the bitwise or of a and b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
or
\_\_
}{
a
\,
b
}
Return the bitwise or of a and b.
\end{funcdesc}
\begin{funcdesc}
{
concat
}{
a
\,
b
}
Return a + b for a and b sequences.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
concat
\_\_
}{
a
\,
b
}
Return a + b for a and b sequences.
\end{funcdesc}
\begin{funcdesc}
{
repeat
}{
a
\,
b
}
Return a * b where a is a sequence and b is an integer.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
repeat
\_\_
}{
a
\,
b
}
Return a * b where a is a sequence and b is an integer.
\end{funcdesc}
\begin{funcdesc}
{
getitem
}{
a
\,
b
}
Return the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
getitem
\_\_
}{
a
\,
b
}
Return the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
setitem
}{
a
\,
b
\,
c
}
Set the value of a at index b to c.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
setitem
\_\_
}{
a
\,
b
\,
c
}
Set the value of a at index b to c.
\end{funcdesc}
\begin{funcdesc}
{
delitem
}{
a
\,
b
}
Set the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
delitem
\_\_
}{
a
\,
b
}
Set the value of a at index b.
\end{funcdesc}
\begin{funcdesc}
{
getslice
}{
a
\,
b
\,
c
}
Return the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
getslice
\_\_
}{
a
\,
b
\,
c
}
Return the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
setslice
}{
a
\,
b
\,
c
\,
v
}
Set the slice of a from index b to index c-1 to the sequence v.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
setslice
\_\_
}{
a
\,
b
\,
c
\,
v
}
Set the slice of a from index b to index c-1 to the sequence v.
\end{funcdesc}
\begin{funcdesc}
{
delslice
}{
a
\,
b
\,
c
}
Delete the slice of a from index b to index c-1.
\end{funcdesc}
\begin{funcdesc}
{
\_\_
delslice
\_\_
}{
a
\,
b
\,
c
}
Delete the slice of a from index b to index c-1.
\end{funcdesc}
Example: Build a dictionary that maps the ordinals from 0 to 256 to their
character equivalents.
\begin{verbatim}
>>> import operator
>>> d =
{}
>>> keys = range(256)
>>> vals = map(chr, keys)
>>> map(operator.setitem, [d]*len(keys), keys, vals)
\end{verbatim}
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