看了点pyCon,感觉收获颇丰

首先时这个讲Terminal的: https://www.youtube.com/watch?v=WAitSilLDUA

some stuff:

“”“

x1b[23A   move cursor 23 rows up

x1b[2J      clear entire screen

x1b[ ?251   hide the cursor

x1b[1m       start writing in bold

x1b[31m      start writing in red

''''

So much fun and interesting!

还有这个,Ned Betchelder讲python的"call-by-assignment" (感觉此人极有可能是python界的Scott Meyer ... )

                                  https://www.youtube.com/watch?v=_AEJHKGk9ns

这个call-by-assignment 时什么意思呢?python的name(或者说variable)和value之间的关系并不像C/C++和Java那样,举个例子来说,C/C++和Java的函数调用要不是pass-by-value就是pass-by-reference,但是python的不一样,python的是夹在中间,Ned Betchelder称之为"pass-by-assignment". 

比如:

1 >>>l = [1,2,3]
2 >>>l[0] = 4    #this change the list to [4,2,3]

但是,考虑这个:


1 >>> l = [1,2,3]
2 >>> def func(someList):
3              someList[0] = [4]   #this also change the list to [4,2,3]
4>>> l
 [4,2,3]  # list changed !

但是,再考虑这个:

1 >>> l = [1,2,3]
2 >>> def func(someList):
3              someLis =  [ 5,6,7]  # this won't change the origiinal list !
4>>> l
[1,2,3]   #still the same

感觉这种方式有点像linux的fork()函数所用的那种" copy-on-write "的技巧。

也可以参考这个链接: http://nedbatchelder.com/text/names1.html

还有Ned Betchalder的这个 Talk: https://www.youtube.com/watch?v=EnSu9hHGq5o

Great

:)

原文地址:https://www.cnblogs.com/walkerlala/p/5324723.html