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
db62967a
Kaydet (Commit)
db62967a
authored
Kas 03, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Re-add two paragraphs that seem to have been lost during the merge from trunk.
üst
a6c04bed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
datamodel.rst
Doc/reference/datamodel.rst
+13
-4
No files found.
Doc/reference/datamodel.rst
Dosyayı görüntüle @
db62967a
...
...
@@ -1289,8 +1289,7 @@ Basic customization
instances are compared by object identity ("address"). See also the
description of :meth:`__hash__` for some important notes on creating
:term:`hashable` objects which support custom comparison operations and are
usable as dictionary keys. (Note: the restriction that exceptions are not
propagated by :meth:`__cmp__` has been removed since Python 1.5.)
usable as dictionary keys.
.. method:: object.__hash__(self)
...
...
@@ -1307,8 +1306,18 @@ Basic customization
(e.g., using exclusive or) the hash values for the components of the object that
also play a part in comparison of objects.
:meth:`__hash__` may also return a long integer object; the 32-bit integer is
then derived from the hash of that object.
If a class does not define a :meth:`__cmp__` or :meth:`__eq__` method it
should not define a :meth:`__hash__` operation either; if it defines
:meth:`__cmp__` or :meth:`__eq__` but not :meth:`__hash__`, its instances
will not be usable as dictionary keys. If a class defines mutable objects
and implements a :meth:`__cmp__` or :meth:`__eq__` method, it should not
implement :meth:`__hash__`, since the dictionary implementation requires that
a key's hash value is immutable (if the object's hash value changes, it will
be in the wrong hash bucket).
User-defined classes have :meth:`__cmp__` and :meth:`__hash__` methods
by default; with them, all objects compare unequal and ``x.__hash__()``
returns ``id(x)``.
.. method:: object.__bool__(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