Python论坛  - 讨论区

标题:[python-chinese] 有什么办法可以deepcopy一个class?

2006年07月18日 星期二 14:43

linda.s samrobertsmith at gmail.com
Tue Jul 18 14:43:00 HKT 2006

有什么办法可以deepcopy一个class?

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月18日 星期二 14:48

刘鑫 march.liu at gmail.com
Tue Jul 18 14:48:37 HKT 2006

Python帮助――库参考手册:

3.18 copy -- Shallow and deep copy operations

This module provides generic (shallow and deep) copying operations.

Interface summary:

import copy

x = copy.copy(y)        # make a shallow copy of y
x = copy.deepcopy(y)    # make a deep copy of y

For module specific errors, copy.error is raised.

在06-7-18,linda. s <samrobertsmith at gmail.com> 写道:
>
> 有什么办法可以deepcopy一个class?
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060718/4b8270ce/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月18日 星期二 15:16

linda.s samrobertsmith at gmail.com
Tue Jul 18 15:16:17 HKT 2006

好象不能深COPY CLASS滴,有什么类似的办法吗?
This version does not copy types like module, class, function, method,
stack trace, stack frame, file, socket, window, array, or any similar
types.

On 7/17/06, 刘鑫 <march.liu at gmail.com> wrote:
> Python帮助――库参考手册:
>
>
> 3.18 copy -- Shallow and deep copy operations
>
>
>
> This module provides generic (shallow and deep) copying operations.
>
> Interface summary:
>
>
> import copy
>
> x = copy.copy(y) # make a shallow copy of y
> x = copy.deepcopy(y) # make a deep copy of y
>
> For module specific errors, copy.error is raised.
>
> 在06-7-18,linda. s <samrobertsmith at gmail.com> 写道:
> > 有什么办法可以deepcopy一个class?
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
>
>
> --
> 欢迎访问:
>  http://blog.csdn.net/ccat
>
> 刘鑫
> March.Liu
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月18日 星期二 15:22

刘鑫 march.liu at gmail.com
Tue Jul 18 15:22:41 HKT 2006

CLASS需要深Copy吗?你在里面加入了静态变量?从语法角度讲,一份Class的copy本身就是一个奇怪的概念……如果你真的需要,自己用Type的底层方法去构造吧,我想,应该有办法的。
感觉copy class像是一个原型模式的特殊实现方法?或者,类工厂?

在06-7-18,linda. s <samrobertsmith at gmail.com> 写道:
>
> 好象不能深COPY CLASS滴,有什么类似的办法吗?
> This version does not copy types like module, class, function, method,
> stack trace, stack frame, file, socket, window, array, or any similar
> types.
>
> On 7/17/06, 刘鑫 <march.liu at gmail.com> wrote:
> > Python帮助――库参考手册:
> >
> >
> > 3.18 copy -- Shallow and deep copy operations
> >
> >
> >
> > This module provides generic (shallow and deep) copying operations.
> >
> > Interface summary:
> >
> >
> > import copy
> >
> > x = copy.copy(y) # make a shallow copy of y
> > x = copy.deepcopy(y) # make a deep copy of y
> >
> > For module specific errors, copy.error is raised.
> >
> > 在06-7-18,linda. s <samrobertsmith at gmail.com> 写道:
> > > 有什么办法可以deepcopy一个class?
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
> >
> >
> > --
> > 欢迎访问:
> >  http://blog.csdn.net/ccat
> >
> > 刘鑫
> > March.Liu
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060718/87acaef6/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号