python中怎么查看帮助_python基础31[help()来查看帮助]

Help on module copy:

NAME

copy-Generic (shallowanddeep) copying operations.

FILE

c:\python31\lib\copy.py

DESCRIPTION

Interface summary:importcopy

x=copy.copy(y)#make a shallow copy of yx=copy.deepcopy(y)#make a deep copy of yFor module specific errors, copy.Errorisraised.

The difference between shallowanddeep copyingisonly relevantforcompound objects (objects that contain other objects, like listsorclassinstances).-A shallow copy constructs a new compound objectandthen (to the

extent possible) inserts*the same objects*into it that the

original contains.-A deep copy constructs a new compound objectandthen, recursively,

inserts*copies*into it of the objects foundinthe original.

Two problems often exist with deep copy operations that don't existwith shallow copy operations:

a) recursive objects (compound objects that, directlyorindirectly,

contain a reference to themselves) may cause a recursive loop

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

copyingpassb) letting user-defined classes override the copying operationorthe

set of components copied

This version doesnotcopy types like module,class, function, method,

nor stack trace, stack frame, nor file, socket, window, nor array, nor

any similar types.

Classes can use the same interfaces to control copying that they use

to control pickling: they can define methods called__getinitargs__(),__getstate__()and__setstate__().  See the documentationformodule"pickle"forinformation on these methods.

CLASSES

builtins.Exception(builtins.BaseException)

Error

... ...

FUNCTIONS

copy(x)

Shallow copy operation on arbitrary Python objects.

See the module's __doc__ string for more info.deepcopy(x, memo=None, _nil=[])

Deep copy operation on arbitrary Python objects.

See the module's __doc__ string for more info.DATA__all__=['Error','copy','deepcopy']

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值