
python
文章平均质量分 67
icyday
在路上,log。。。。
展开
-
python的__slots__
python新模式的class,即从object继承下来的类有一个变量是__slots__,slots的作用是阻止在实例化类时为实例分配dict,默认情况下每个类都会有一个dict,通过__dict__访问,这个dict维护了这个实例的所有属性,举例如下 class base(object): v = 1 def __init__(self): pass转载 2014-04-21 11:56:30 · 687 阅读 · 0 评论 -
python的修饰符
@property class cls(obj原创 2014-04-25 14:50:20 · 651 阅读 · 0 评论 -
python __debug__与sys.path_hooks
__debug__ This constant is true if Python was not started with an -O option.See also the assert statement. Note The names None and __debug__ cannot be reassigned(assignments to them, e翻译 2014-07-08 10:41:32 · 3929 阅读 · 0 评论 -
字符串匹配的Boyer-Moore算法
各种文本编辑器的”查找”功能(Ctrl+F),大多采用Boyer-Moore算法。 bm算法的转载 2014-07-29 22:10:35 · 953 阅读 · 0 评论 -
python版线段树
#coding=gbk #线段树 class Tree(object): def __init__(self,l,r): self.l = l self.r = r self.value = 0 self.left = None self.right = None if l < r: mid = (l + r)/2 self.left = Tree(l,mid原创 2016-03-02 10:45:36 · 2810 阅读 · 0 评论