Dive Into Python的笔记(22)
>我来写笔记
按有用程度 按页码先后 最新笔记
-
Further Reading
Chapter 2: PEP 257 -- Docstring Conventions http://www.python.org/dev/peps/pep-0257/ Python Objects http://effbot.org/zone/python-objects.htm http://docs.python.org/reference/datamodel.html#objects Indentation http://docs.python.org/reference/lexical_analysis.html#indentation PEP 8 -- Style Guide for Python Code Import http://docs.python.org/reference/simple_stmts.html#import D... (更多)2012-04-22 21:05:40 回应
-
18.2. Using the timeit Module
>>> import timeit >>> t = timeit.Timer("soundex.soundex('Pilgrim')", ... "import soundex") >>> t.timeit() 8.21683733547 >>> t.repeat(3, 2000000) [16.48319309109, 16.46128984923, 16.44203948912] 1.The timeit module defines one class, Timer, which takes two arguments. Both arguments are strings. The first argu... (更多)2012-02-21 21:09:53 回应
-
第十一讲:exceptions、Debug
白乌鸦 (Understand yourself)
分类:可处理和不可处理 作用:人机交互,人录入错误则抛出异常 可分阶段处理错误 exception 和 assert 的区别 assert(断言):当满足限制条件时,才会执行codes用来告诉用户,你应该输出什么 assert距离 >>> mylist = ['item'] >>> assert len(mylist)>=1 >>> mylist.pop() >>> 'item' >>> assert len(mylist)>=1 >>> 抛出Asse... (更多)2011-12-08 14:07:02 回应





