由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - Python list 's copy
相关主题
再谈湾区工作,Python R及SAS如何用macro修改format value
请教R和 usenet的问题菜鸟问个SAS问题: sashelp里的vmacro 不work了!
Re: 生物转CS,大家觉得应该转吗 (转载)问一个格式转换的问题
Is the process flawed?SAS Question 请教
A SAS problemsas 中 find()里 modifier 是起什么作用的?
R-Question about attachJSM paper
SAS Macro question, thanks!求教一个code function,怎样把string前面的几个数字去掉
Modify the label of cdf plot in SAS?求助,SAS处理数据的一个问题 包子答谢
相关话题的讨论汇总
话题: list话题: python话题: same话题: see话题: change
进入Statistics版参与讨论
1 (共1页)
S******y
发帖数: 1123
1
>>> x=[1,2,3]
>>> y=x
>>> x.remove(3)
>>> x
[1, 2]
>>> y
[1, 2]
As you can see, both x and y change same time.
c*******1
发帖数: 240
2
y = x
is called aliasing. x and y refer to the same list in memory.
you can type t
id(x)
id(y)
to see it.
x.remove
is a method of list, it modifies the list x points to
x = [1,2]
creates a new list and changes the address x is referring to
it is no different from
x = 'asdf'
or
x = 1.201
equal sign is an operation on the name x, not the object x points to.
just remember python has no variable. every so-called variable is a pointer
S******y
发帖数: 1123
3
Thanks a lot!
s*********e
发帖数: 1051
4
>>> x = [1, 2, 3]
>>> y = []
>>> for i in x:
y.append(i)

>>> y
[1, 2, 3]
>>> x.remove(3)
>>> x
[1, 2]
>>> y
[1, 2, 3]
>>>
1 (共1页)
进入Statistics版参与讨论
相关主题
求助,SAS处理数据的一个问题 包子答谢A SAS problem
Python:请问如何把list变成structured array。 (转载)R-Question about attach
有没有办法取代SAS。SAS Macro question, thanks!
安装NumPy碰到困难。Modify the label of cdf plot in SAS?
再谈湾区工作,Python R及SAS如何用macro修改format value
请教R和 usenet的问题菜鸟问个SAS问题: sashelp里的vmacro 不work了!
Re: 生物转CS,大家觉得应该转吗 (转载)问一个格式转换的问题
Is the process flawed?SAS Question 请教
相关话题的讨论汇总
话题: list话题: python话题: same话题: see话题: change