15.6.11

Python tricks

1. >>> a=b=c=0.
>>> a=1.
>>> a
1.0
>>> b
0.0
>>> c
0.0

2.>>> a=b=c=[0.,0.,0.,0.]
>>> a[0]=1.0
>>> a
[1.0, 0.0, 0.0, 0.0]
>>> b
[1.0, 0.0, 0.0, 0.0]
>>> c
[1.0, 0.0, 0.0, 0.0]

没有评论: