Python论坛  - 讨论区

标题:[python-chinese] two questions

2005年08月09日 星期二 20:02

Dryice Liu dryiceliu at gmail.com
Tue Aug 9 20:02:37 HKT 2005

"小楼听雨"<hailang_0512 at 163.com> wrote:

> def foo(par=[]):
>     if par is None:

这一句不为真

>         par = []
>         par.append(0)
>     print par
>
> foo()
> print foo.func_defaults
>
> foo()
> print foo.func_defaults
>
> foo([9])
> print foo.func_defaults
>
> foo()
> print foo.func_defaults
>
> 结果是:
> []         
> ([],) #为什么不是([0],)
> []
> ([],)
> [9]
> ([],)
> []
> ([],)
>  难道是par.append(0)的问题?
>   
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese

-- 
Dryice @ http://dryice.3322.org

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/sylvester-response.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20050809/d2ac667b/attachment.pgp

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号