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
1156f623
Kaydet (Commit)
1156f623
authored
Eyl 19, 2000
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Many small clarifications, including many suggested by email.
üst
b96e0e5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
ref5.tex
Doc/ref/ref5.tex
+18
-17
No files found.
Doc/ref/ref5.tex
Dosyayı görüntüle @
1156f623
...
...
@@ -676,11 +676,10 @@ converted to a common type.
\section
{
Comparisons
\label
{
comparisons
}}
\index
{
comparison
}
Contrary to
\C
, all comparison operations in Python have the same
priority, which is lower than that of any arithmetic, shifting or
bitwise operation. Also contrary to
\C
, expressions like
\code
{
a < b < c
}
have the interpretation that is conventional in
mathematics:
Unlike C, all comparison operations in Python have the same priority,
which is lower than that of any arithmetic, shifting or bitwise
operation. Also unlike C, expressions like
\code
{
a < b < c
}
have the
interpretation that is conventional in mathematics:
\indexii
{
C
}{
language
}
\begin{verbatim}
...
...
@@ -708,11 +707,12 @@ perfectly legal (though perhaps not pretty).
The forms
\code
{
<>
}
and
\code
{
!=
}
are equivalent; for consistency with
C,
\code
{
!=
}
is preferred; where
\code
{
!=
}
is mentioned below
\code
{
<>
}
is also accept
able. At some point in the (far) future,
\code
{
<>
}
may become obsolete
.
\code
{
<>
}
is also accept
ed. The
\code
{
<>
}
spelling is considered
obsolescent
.
The operators
\texttt
{
"<", ">", "==", ">=", "<="
}
, and
\texttt
{
"!="
}
compare
the values of two objects. The objects needn't have the same type.
The operators
\code
{
<
}
,
\code
{
>
}
,
\code
{
==
}
,
\code
{
>=
}
,
\code
{
<=
}
, and
\code
{
!=
}
compare
the values of two objects. The objects need not have the same type.
If both are numbers, they are coverted to a common type. Otherwise,
objects of different types
\emph
{
always
}
compare unequal, and are
ordered consistently but arbitrarily.
...
...
@@ -732,7 +732,8 @@ Numbers are compared arithmetically.
\item
Strings are compared lexicographically using the numeric equivalents
(the result of the built-in function
\function
{
ord()
}
) of their
characters.
characters. Unicode and 8-bit strings are fully interoperable in this
behavior.
\item
Tuples and lists are compared lexicographically using comparison of
...
...
@@ -765,19 +766,19 @@ For the list, tuple types, \code{\var{x} in \var{y}} is true if and only
if there exists such an index
\var
{
i
}
such that
\code
{
var
{
x
}
==
\var
{
y
}
[
\var
{
i
}
]
}
is true.
For the Unicode and string types,
\code
{
\var
{
x
}
in
\var
{
y
}}
is true if
and only
if there exists such an index
\var
{
i
}
such that
\
code
{
var
{
x
}
==
\var
{
y
}
[
\var
{
i
}
]
}
is true. If
\code
{
\var
{
x
}}
is not
a string of length
\code
{
1
}
or a unicode object of length
\code
{
1
}
,
a
\exception
{
TypeError
}
exception
is raised.
For the Unicode and string types,
\code
{
\var
{
x
}
in
\var
{
y
}}
is true if
and only if there exists an index
\var
{
i
}
such that
\code
{
\var
{
x
}
==
\
var
{
y
}
[
\var
{
i
}
]
}
is true. If
\code
{
\var
{
x
}}
is not a string or
Unicode object of length
\code
{
1
}
, a
\exception
{
TypeError
}
exception
is raised.
For user-defined classes which define the
\method
{__
contains
__
()
}
method,
\code
{
\var
{
x
}
in
\var
{
y
}}
is true if and only if
\code
{
\var
{
y
}
.
__
contains
__
(
\var
{
x
}
)
}
is true.
For user-defined classes which do not define
\method
{__
contains
__
()
}
and
do define
\
var
{__
getitem
__}
,
\code
{
\var
{
x
}
in
\var
{
y
}}
is true if and only
if there is a non-negative integer index
\var
{
i
}
such that
do define
\
method
{__
getitem
__
()
}
,
\code
{
\var
{
x
}
in
\var
{
y
}}
is true if
and only
if there is a non-negative integer index
\var
{
i
}
such that
\code
{
\var
{
x
}
==
\var
{
y
}
[
\var
{
i
}
]
}
, and all lower integer indices
do not raise
\exception
{
IndexError
}
exception. (If any other exception
is raised, it is as if
\keyword
{
in
}
raised that exception).
...
...
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