Python简单介绍
- 30. #Yes
a = 1 + 2
blockq = 3 + 4
#No
a = 1 + 2
blockq = 3 + 4
30
- 35. • None, as 成了关键字
• print 成了函数
• dict.has_key 改用in操作符
• int和long没有差别了
• 所有的strings都是Unicode
• 不可比的类型之间比较将出异常
• <>操作符没有了,!=代替
• apply()用f(*args,**kw)代替
• xrange()用rang()代替
• map和filter没有了,list可以管
• etc.
35
- 37. • Removed
• sha,md5: hashlib代替
• mimetools: email package代替
• timing: time.clock()代替
• Renamed
• cPickle: _pickle
• StringIO/cStringIO: 成了io的一个class
• HTMLParser: http.client
• BaseHTTPServer: http.server
• CGIHTTPServer: http.server
• SimpleHTTPServer: http.server
37
- 40. 参考资料
• PEP: http://www.python.org/dev/peps/
• 8: Style Guide for Python Code
• 3000: Python 3000
• 263: Defining Python Source Code
Encodings
• Py3k: http://wiki.python.org/moin/
Python3.0
• Python Shell Tab Completion: http://
blog.yzlin.org/2008/12/22/75/
40
- 41. • iPython: http://ipython.scipy.org/moin/
• python常用模块: http://
wiki.woodpecker.org.cn/moin/
PyCommonUsageMod
• python中文处理: http://
wiki.woodpecker.org.cn/moin/PyInChinese
• Python编辑速度技巧: http://
wiki.woodpecker.org.cn/moin/PyOptimize
• vim的tabstop: http://blog.khsing.net/
2008/12/vims-tabstop.html
41