- 博客(7)
- 收藏
- 关注
原创 Python的metaclass和decorator的元编程
Python的元编程一般是使用metaclass动态生成和修改修改类。class metacls(type): def __new__(cls, name, bases, dct): dct['metacls_attr'] = 'metacls_attr' print 'metacls __new__' return type.__new
2012-11-16 20:26:50 539
原创 Python的metaclass构建类过程
metaclass文章集: http://www.mantingzhou.com/subject/40/python的metaclass晦涩难懂,本文通过调试工具展示metaclass构建类的过程。Python使用type()构建类(新式类),构建过程是先读入类定义到一个独立的命名空间,接着调用type(name, bases, dict)生成新的类对象,最后把生成类对象绑定到类名
2012-11-15 20:17:28 431
转载 跳表(skip list)
本篇文章解释跳表实现原理比较清晰。http://kenby.iteye.com/blog/1187303本篇文章跳表算法实现。http://www.cnblogs.com/xuqiang/archive/2011/05/22/2053516.html
2012-10-15 16:50:16 647
翻译 探究Redis字符串(Hacking Strings)
探究Redis字符串(Hacking Strings)原文:http://www.redis.io/topics/internals-sds源码:https://github.com/antirez/redis/blob/unstable/src/sds.cRedis字符串实现包含在sds.c中。(sds代表Simple Dynamic Strings.)sds.h中结构体
2012-10-12 01:55:06 355
原创 大小字端转化工具(redis)
redis里的大小字端转化工具,实现的很精巧,特别是测试用例。http://www.mantingzhou.com/subject/5//* endinconv.c -- Endian conversions utilities. */#include /* Toggle the 16 bit unsigned integer pointed by *p from li
2012-10-10 10:08:36 759
原创 Redis Transactions
Transactions:http://redis.io/topics/transactionsimport rediswith redis.Redis().pipeline() as pipe: pipe.watch('a', 'b', 'c') pipe.multi() pipe.set('a', 1).set('b', 2).set('c', 3)
2012-10-09 12:03:02 641
原创 redis pipeline|Request/Response protocols and RTT(python)
redis pipeline:http://redis.io/topics/pipelininghttp://www.cnblogs.com/redcreen/archive/2011/02/15/1955517.htmlredis-py:https://github.com/antirez/redispython代码实现def without_pipeli
2012-10-08 22:56:22 879
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人