Michael Torrie於 2013年6月20日星期四UTC+8下午2時01分11秒寫道:
>
> But since the LISP never really got a form beyond S-expressions,
>
> leaving us with lots of parenthesis everywhere, Python wins much as the
>
> Hitchhiker's Guide to the Galaxy wins.
Yep, a list is mutable even it's empty.
But constant integers, floats, strings, and None is immutable.
The variables in a function of python with default
parameters which could be mutable or immutable.
def fun1( x, alist=[]):
alist.append(x*x)
return alist ## valid
def fun2(x, alist=None):
if alist==None: alist=[]
alist.append(x*x)
return alist
# kind of boring to show the name binding mechanism of objects
# in Python in different usages
--
http://mail.python.org/mailman/listinfo/python-list