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
a192828e
Kaydet (Commit)
a192828e
authored
Eki 17, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#9138: reword introduction to classes in Python.
üst
f4142726
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
classes.rst
Doc/tutorial/classes.rst
+16
-16
No files found.
Doc/tutorial/classes.rst
Dosyayı görüntüle @
a192828e
...
@@ -4,26 +4,26 @@
...
@@ -4,26 +4,26 @@
Classes
Classes
*******
*******
Python's class mechanism adds classes to the language with a minimum of new
Compared with other programming languages, Python's class mechanism adds classes
syntax and semantics. It is a mixture of the class mechanisms found in C++ and
with a minimum of new syntax and semantics. It is a mixture of the class
Modula-3. As is true for modules, classes in Python do not put an absolute
mechanisms found in C++ and Modula-3. Python classes provide all the standard
barrier between definition and user, but rather rely on the politeness of the
features of Object Oriented Programming: the class inheritance mechanism allows
user not to "break into the definition." The most important features of classes
are retained with full power, however: the class inheritance mechanism allows
multiple base classes, a derived class can override any methods of its base
multiple base classes, a derived class can override any methods of its base
class or classes, and a method can call the method of a base class with the same
class or classes, and a method can call the method of a base class with the same
name. Objects can contain an arbitrary amount of data.
name. Objects can contain arbitrary amounts and kinds of data. As is true for
modules, classes partake of the dynamic nature of Python: they are created at
runtime, and can be modified further after creation.
In C++ terminology, normally class members (including the data members) are
In C++ terminology, normally class members (including the data members) are
*public* (except see below :ref:`tut-private`),
*public* (except see below :ref:`tut-private`),
and all member functions are
and all member functions are *virtual*. As in Modula-3, there are no shorthand
s
*virtual*. As in Modula-3, there are no shorthands for referencing the object'
s
for referencing the object's members from its methods: the method function is
members from its methods: the method function is declared with an explicit first
declared with an explicit first argument representing the object, which i
s
argument representing the object, which is provided implicitly by the call. A
s
provided implicitly by the call. As in Smalltalk, classes themselves are
in Smalltalk, classes themselves are objects. This provides semantics for
objects. This provides semantics for importing and renaming. Unlike C++ and
importing and renaming. Unlike C++ and Modula-3, built-in types can be used as
Modula-3, built-in types can be used as base classes for extension by the user.
base classes for extension by the user. Also, like in C++, most built-in
Also, like in C++, most built-in operators with special syntax (arithmetic
operators with special syntax (arithmetic operators, subscripting etc.) can be
operators, subscripting etc.) can be
redefined for class instances.
redefined for class instances.
(Lacking universally accepted terminology to talk about classes, I will make
(Lacking universally accepted terminology to talk about classes, I will make
occasional use of Smalltalk and C++ terms. I would use Modula-3 terms, since
occasional use of Smalltalk and C++ terms. I would use Modula-3 terms, since
...
...
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