引发自:[wiki:PyCNmail/2005-June/011209.html Py的几处不爽]

讨论习惯势力在Py 中的思路

::-- ZoomQuiet [DateTime(2005-06-10T01:34:11Z)] TableOfContents {{{发件人: flyaflyaa <[email protected]> 回复: [email protected] 收件人: [email protected] 日期: 2005-6-8 下午2:29 主题: [python-chinese] py的几处不爽 }}}

揭题

{{{一、

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 如果a中元素是数,用for就不能改变a中元素,只能用filter,map,reduce作复杂 处理了,如果a中元素是list,就可以。不统一。

二、 a = "abccdd" a[0] = 'c" 出错,想改a中的一个元素就要再生成一个新的string,这多慢

三、 函数默认参数是list的话,每次调用都用同一个list,会发生错误。

[10]

[10, 10]

这个问题影响不大,可为什么不改掉,很容易产生错误 }}}

讨论