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
cf51dacf
Kaydet (Commit)
cf51dacf
authored
Haz 30, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Document __copy__() and __deepcopy__() methods.
üst
5b68362a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
libcopy.tex
Doc/lib/libcopy.tex
+14
-1
No files found.
Doc/lib/libcopy.tex
Dosyayı görüntüle @
cf51dacf
...
...
@@ -57,7 +57,7 @@ Python's \code{deepcopy()} operation avoids these problems by:
\begin{itemize}
\item
keeping a
table
of objects already copied during the current
keeping a
``memo'' dictionary
of objects already copied during the current
copying pass; and
\item
...
...
@@ -75,8 +75,21 @@ to control pickling: they can define methods called
\code
{__
getinitargs
__
()
}
,
\code
{__
getstate
__
()
}
and
\code
{__
setstate
__
()
}
. See the description of module
\code
{
pickle
}
for information on these methods.
The copy module does not use the
\module
{
copy
_
reg
}
registration
module.
\refstmodindex
{
pickle
}
\setindexsubitem
{
(copy protocol)
}
\ttindex
{__
getinitargs
__}
\ttindex
{__
getstate
__}
\ttindex
{__
setstate
__}
In order for a class to define its own copy implementation, it can
define special methods
\method
{__
copy
__
()
}
\ttindex
{__
copy
__}
and
\method
{__
deepcopy
__
()
}
\ttindex
{__
deepcopy
__}
. The former is called to
implement the shallow copy operation; no additional arguments are
passed. The latter is called to implement the deep copy operation; it
is passed one argument, the memo dictionary. If the
\method
{__
deepcopy
__
()
}
implementation needs to make a deep copy of a
component, it should call the
\function
{
deepcopy()
}
function with the
component as first argument and the memo dictionary as second
argument.
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