阿小信大人的头像
做你说过的,说你能做的 阿小信大人

args for pwd in shell2015-07-07 13:36


ashin@MacBook-Pro:~/Projects/turalyon/turalyon
> echo ${PWD:A}
/Users/ashin/Projects/turalyon/turalyon
ashin@MacBook-Pro:~/Projects/turalyon/tu

......
#Linux/Mac#   评论[0]阅读全文[1099]

What “is” a fuck in Python2015-07-01 17:45

CPython的优化

>>> x = 'a' * 20
>>> y = 'a' * 20
>>> x is y
True
>>> x = 'a' * 21
>>> y = 'a' * 21
>>> x is y
False
>>> x = 'a' * 21; y = 'a' * 21
>>> x is y
False
>>> x = 'aaaaaaaaaaaaaaaaaaaaa'
>>> len(x)
21
>>> y = 'a

......
#Python#   评论[0]阅读全文[1380]

None in Python2015-07-01 16:45

========

####“is None”比 “== None”更快。

“is”是用C实现的, 简单的比较两个对象的ID,不需要调用任何方法函数, “is”是比较id,“==”是比较值。

创建一个None实例:

Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for mor

......
#Python#   评论[0]阅读全文[1272]