summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-28 19:31:14 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-28 19:31:14 (GMT)
commitf7cea10f80093662b80ea82b4ca368681dd6873a (patch)
tree5601e50b6805c09cf05226c3b114b5511b658b97 /Lib
parente3f5b9c8d1e6385269a022d800286ee9ed4048d4 (diff)
downloadcpython-f7cea10f80093662b80ea82b4ca368681dd6873a.zip
cpython-f7cea10f80093662b80ea82b4ca368681dd6873a.tar.gz
cpython-f7cea10f80093662b80ea82b4ca368681dd6873a.tar.bz2
Remove '(' in column 0 of doc strings.
Add dependency on dict.copy().
Diffstat (limited to 'Lib')
-rw-r--r--Lib/copy.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 15e0e40..6dc781c 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -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}