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
e490502e
Kaydet (Commit)
e490502e
authored
Nis 10, 2005
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug #1179957: Missing def'n of equality for set elements
üst
95ed80b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
libsets.tex
Doc/lib/libsets.tex
+4
-1
libstdtypes.tex
Doc/lib/libstdtypes.tex
+3
-0
No files found.
Doc/lib/libsets.tex
Dosyayı görüntüle @
e490502e
...
...
@@ -30,7 +30,10 @@ method but omits methods which alter the contents of the set. Both
abstract class useful for determining whether something is a set:
\code
{
isinstance(
\var
{
obj
}
, BaseSet)
}
.
The set classes are implemented using dictionaries. As a result, sets
The set classes are implemented using dictionaries. Accordingly, the
requirements for set elements are the same as those for dictionary keys;
namely, that the element defines both
\method
{__
eq
__}
and
\method
{__
hash
__}
.
As a result, sets
cannot contain mutable elements such as lists or dictionaries.
However, they can contain immutable collections such as tuples or
instances of
\class
{
ImmutableSet
}
. For convenience in implementing
...
...
Doc/lib/libstdtypes.tex
Dosyayı görüntüle @
e490502e
...
...
@@ -1220,6 +1220,9 @@ Accordingly, sets do not implement the \method{__cmp__} method.
Since sets only define partial ordering (subset relationships), the output
of the
\method
{
list.sort()
}
method is undefined for lists of sets.
Set elements are like dictionary keys; they need to define both
\method
{__
hash
__}
and
\method
{__
eq
__}
methods.
Binary operations that mix
\class
{
set
}
instances with
\class
{
frozenset
}
return the type of the first operand. For example:
\samp
{
frozenset('ab') | set('bc')
}
returns an instance of
\class
{
frozenset
}
.
...
...
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