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
299172bd
Kaydet (Commit)
299172bd
authored
Tem 26, 2011
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make indentation comply with our style guide and the rest of the file
üst
2e1c294d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
classes.rst
Doc/tutorial/classes.rst
+14
-14
No files found.
Doc/tutorial/classes.rst
Dosyayı görüntüle @
299172bd
...
@@ -556,24 +556,24 @@ occurs within the definition of a class.
...
@@ -556,24 +556,24 @@ occurs within the definition of a class.
Name mangling is helpful for letting subclasses override methods without
Name mangling is helpful for letting subclasses override methods without
breaking intraclass method calls. For example::
breaking intraclass method calls. For example::
class Mapping:
class Mapping:
def __init__(self, iterable):
def __init__(self, iterable):
self.items_list = []
self.items_list = []
self.__update(iterable)
self.__update(iterable)
def update(self, iterable):
def update(self, iterable):
for item in iterable:
for item in iterable:
self.items_list.append(item)
self.items_list.append(item)
__update = update # private copy of original update() method
__update = update # private copy of original update() method
class MappingSubclass(Mapping):
class MappingSubclass(Mapping):
def update(self, keys, values):
def update(self, keys, values):
# provides new signature for update()
# provides new signature for update()
# but does not break __init__()
# but does not break __init__()
for item in zip(keys, values):
for item in zip(keys, values):
self.items_list.append(item)
self.items_list.append(item)
Note that the mangling rules are designed mostly to avoid accidents; it still is
Note that the mangling rules are designed mostly to avoid accidents; it still is
possible to access or modify a variable that is considered private. This can
possible to access or modify a variable that is considered private. This can
...
...
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