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
518d8da0
Kaydet (Commit)
518d8da0
authored
Ara 06, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 1163367: Clarify super() docs. Also, fix-up the markup and XXX comment.
üst
40c509d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
functions.rst
Doc/library/functions.rst
+9
-8
No files found.
Doc/library/functions.rst
Dosyayı görüntüle @
518d8da0
...
@@ -1037,9 +1037,7 @@ are always available. They are listed here in alphabetical order.
...
@@ -1037,9 +1037,7 @@ are always available. They are listed here in alphabetical order.
.. function:: super([type[, object-or-type]])
.. function:: super([type[, object-or-type]])
.. XXX updated as per http://www.artima.com/weblogs/viewpost.jsp?thread=208549 but needs checking
Return a *super* object that acts as a proxy to superclasses of *type*.
Return a "
super
" object that acts like the superclass of *type*.
If the second argument is omitted the super object returned is unbound. If
If the second argument is omitted the super object returned is unbound. If
the second argument is an object, ``isinstance(obj, type)`` must be true. If
the second argument is an object, ``isinstance(obj, type)`` must be true. If
...
@@ -1047,8 +1045,8 @@ are always available. They are listed here in alphabetical order.
...
@@ -1047,8 +1045,8 @@ are always available. They are listed here in alphabetical order.
Calling :func:`super` without arguments is equivalent to ``super(this_class,
Calling :func:`super` without arguments is equivalent to ``super(this_class,
first_arg)``.
first_arg)``.
There are two typical use cases for
"
super
"
. In a class hierarchy with
There are two typical use cases for
:func:`super`
. In a class hierarchy with
single inheritance,
"
super
"
can be used to refer to parent classes without
single inheritance,
:func:`super`
can be used to refer to parent classes without
naming them explicitly, thus making the code more maintainable. This use
naming them explicitly, thus making the code more maintainable. This use
closely parallels the use of "
super
" in other programming languages.
closely parallels the use of "
super
" in other programming languages.
...
@@ -1072,9 +1070,12 @@ are always available. They are listed here in alphabetical order.
...
@@ -1072,9 +1070,12 @@ are always available. They are listed here in alphabetical order.
It does so by implementing its own :meth:`__getattribute__` method for searching
It does so by implementing its own :meth:`__getattribute__` method for searching
parent classes in a predictable order that supports cooperative multiple inheritance.
parent classes in a predictable order that supports cooperative multiple inheritance.
Accordingly, :func:`super` is undefined for implicit lookups using statements or
Accordingly, :func:`super` is undefined for implicit lookups using statements or
operators such as ``super()[name]``. Also, :func:`super` is not
operators such as ``super()[name]``.
limited to use inside methods: under the hood it searches the stack
frame for the class (``__class__``) and the first argument.
Also note that :func:`super` is not limited to use inside methods. The
two argument specifies the arguments exactly and makes the appropriate
references. The zero argument form automatically searches the stack frame
for the class (``__class__``) and the first argument.
.. function:: tuple([iterable])
.. function:: tuple([iterable])
...
...
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