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
f7cea10f
Kaydet (Commit)
f7cea10f
authored
May 28, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove '(' in column 0 of doc strings.
Add dependency on dict.copy().
üst
e3f5b9c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
copy.py
Lib/copy.py
+12
-10
No files found.
Lib/copy.py
Dosyayı görüntüle @
f7cea10f
...
...
@@ -25,19 +25,19 @@ class instances).
Two problems often exist with deep copy operations that don't exist
with shallow copy operations:
(
a) recursive objects (compound objects that, directly or indirectly,
a) recursive objects (compound objects that, directly or indirectly,
contain a reference to themselves) may cause a recursive loop
(
b) because deep copy copies *everything* it may copy too much, e.g.
b) because deep copy copies *everything* it may copy too much, e.g.
administrative data structures that should be shared even between
copies
Python's deep copy operation avoids these problems by:
(
a) keeping a table of objects already copied during the current
copying pass
a) keeping a table of objects already copied during the current
copying pass
(
b) letting user-defined classes override the copying operation or the
b) letting user-defined classes override the copying operation or the
set of components copied
This version does not copy types like module, class, function, method,
...
...
@@ -97,10 +97,7 @@ def _copy_tuple(x):
d
[
types
.
TupleType
]
=
_copy_tuple
def
_copy_dict
(
x
):
y
=
{}
for
key
in
x
.
keys
():
y
[
key
]
=
x
[
key
]
return
y
return
x
.
copy
()
d
[
types
.
DictionaryType
]
=
_copy_dict
def
_copy_inst
(
x
):
...
...
@@ -238,7 +235,12 @@ def _test():
def
__init__
(
self
,
arg
=
None
):
self
.
a
=
1
self
.
arg
=
arg
self
.
fp
=
open
(
'copy.py'
)
if
__name__
==
'__main__'
:
import
sys
file
=
sys
.
argv
[
0
]
else
:
file
=
__file__
self
.
fp
=
open
(
file
)
self
.
fp
.
close
()
def
__getstate__
(
self
):
return
{
'a'
:
self
.
a
,
'arg'
:
self
.
arg
}
...
...
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