如果
somefunction返回可变值,它们不一定会一样工作。考虑:
>>> def somefunction():... return []... >>> x = y = somefunction()>>> x.append(4)>>> x[4]>>> y[4]>>> x = somefunction(); y = somefunction()>>> x.append(3)>>> x[3]>>> y[]

如果
somefunction返回可变值,它们不一定会一样工作。考虑:
>>> def somefunction():... return []... >>> x = y = somefunction()>>> x.append(4)>>> x[4]>>> y[4]>>> x = somefunction(); y = somefunction()>>> x.append(3)>>> x[3]>>> y[]