風語·深蓝

Agile Methodology, HeadStorm And MindMap, they will change me.

导航

2014年1月5日

摘要: 转自:http://www.blogjava.net/vagasnail/articles/301140.html?opt=admin介绍下Python 中 map,reduce,和filter 内置函数的方法:一:mapmap(...) map(function, sequence[, sequence, ...]) -> list说明:对sequence中的item依次执行function(item),执行结果输出为list。例子:>>> map(str, range(5)) #对range(5)各项进行str操作['0', '1', 阅读全文

posted @ 2014-01-05 23:40 風語者·疾風 阅读(17294) 评论(2) 推荐(4) 编辑

摘要: 1) 基本概念1.1 常量 Python没有提供常量保留字,需要自行扩展一个常量类来实现常量功能class _const: class ConstError(TypeError):pass def __setattr__(self,name,value): if self.__dict__.has_key(name): raise self.ConstError,"Can't rebind const (%s)"% name self.__dict__[name]=valueimport syssys.modules[... 阅读全文

posted @ 2014-01-05 06:33 風語者·疾風 阅读(519) 评论(0) 推荐(0) 编辑