摘要: 像if…else…这种没必要细说,Python中比C/C++多出来的有while…else…/for…else…/try…else…。while…else…/for…else…工作顺序为:在循环中使用时,else语句只在循环完成后执行,也就是说,break语句也会跳过else代码块,只要循环是正常结束,而不是通过break,else语句就会执行。try…else…功能和循环中的else语句没有多大区别:在try范围内没有检测到异常的时候,执行else子句。 阅读全文
posted @ 2012-12-24 14:12 紫红的泪 阅读(1916) 评论(1) 推荐(0) 编辑
摘要: 在stackoverflow上看到的一篇,刚好解答了我的疑惑:http://stackoverflow.com/questions/68630/are-tuples-more-efficient-than-lists-in-python The "dis" module disassembles the byte code for a function and is usefu... 阅读全文
posted @ 2012-12-24 12:49 紫红的泪 阅读(295) 评论(0) 推荐(0) 编辑