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
8315da4c
Kaydet (Commit)
8315da4c
authored
Eyl 02, 2008
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clarify example; add imports
üst
31a0a147
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
2.6.rst
Doc/whatsnew/2.6.rst
+10
-4
No files found.
Doc/whatsnew/2.6.rst
Dosyayı görüntüle @
8315da4c
...
...
@@ -1224,7 +1224,7 @@ do it where it's absolutely necessary.
You can write your own ABCs by using ``abc.ABCMeta`` as the
metaclass in a class definition::
from abc import ABCMeta
from abc import ABCMeta
, abstractmethod
class Drawable():
__metaclass__ = ABCMeta
...
...
@@ -1256,15 +1256,21 @@ exception for classes that don't define the method.
Note that the exception is only raised when you actually
try to create an instance of a subclass lacking the method::
>>> s=Square()
>>> class Circle(Drawable):
... pass
...
>>> c=Circle()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class
Squar
e with abstract methods draw
TypeError: Can't instantiate abstract class
Circl
e with abstract methods draw
>>>
Abstract data attributes can be declared using the
``@abstractproperty`` decorator::
from abc import abstractproperty
...
@abstractproperty
def readonly(self):
return self._x
...
...
@@ -3206,5 +3212,5 @@ Acknowledgements
The author would like to thank the following people for offering suggestions,
corrections and assistance with various drafts of this article:
Georg Brandl, Nick Coghlan, Jim Jewett, Antoine Pitrou.
Georg Brandl,
Steve Brown,
Nick Coghlan, Jim Jewett, Antoine Pitrou.
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