Python介绍
limodou
limodou@gmail.com
一、开场白
- 什么是Python
Python是一种语法简洁优美的,面向对象的,内置高级数据结构,支持模块和包,支持多种平台,可扩展的解释型通用编程语言。
- Python的读法
- 学习Python有哪些好处
- 掌握一种新的编程语言,一种新技能
- 体会动态语言的妙处
- 体验快速开发的快感
- 让你实现快速学习的梦想
[any material that should appear in print but not on the slide]
二、Python的历史
创始人Guido van Rossum,原在荷兰,现在美国。
[any material that should appear in print but not on the slide]
2.1 Python的历史
Python的创始人为Guido van Rossum。1989年圣诞节期间,在阿姆斯特丹,Guido为了打发圣诞节的无趣,决心开发一个新的脚本解释程序,做为ABC语言的一种继承。之所以选中Python作为程序的名字,是因为他是一个Monty 大蟒蛇飞行马戏团的爱好者。
[any material that should appear in print but not on the slide]
2.2 Python的历史
ABC是由Guido参加设计的一种教学语言。就Guido本人看来,ABC这种语言非常优美和强大,是专门为非专业程序员设计的。但是ABC语言并没有成功,究其原因,Guido认为是非开放造成的。Guido决心在Python中避免这一错误(的确如此,Python与其它的语言如C,C++和Java结合的非常好)。同时,他还想实现在ABC中闪现过但未曾实现的东西。
[any material that should appear in print but not on the slide]
2.3 Python的历史
就这样,Python在Guido手中诞生了。实际上,第一个实现是在Mac机上。可以说,Python是从ABC发展起来,主要受到了Modula-3(另一种相当优美且强大的语言,为小型团体所设计的)的影响。并且结合了Unix Shell和C的习惯。
[any material that should appear in print but not on the slide]
2.4 Python的历史
目前Python已经发展到 2.4.1
可以在众多的平台上运行
[any material that should appear in print but not on the slide]
三、Python的应用领域
- GUI开发,网络开发
- 图形开发,文档处理
- 游戏开发,Web开发
- 科学计算,移动开发
- 嵌入开发,数据库开发
- ...
[any material that should appear in print but not on the slide]
3.1 GUI
- tcl/tk
- wxPython
- pygtk
- pyqt
- ctypes
- pyswt
[any material that should appear in print but not on the slide]
3.2 网络
- socket编程
- twisted
- jabber
- python-qq
[any material that should appear in print but not on the slide]
3.3 图形
[any material that should appear in print but not on the slide]
3.4 文档
- epydoc
- reStruecturedText
- reportlab
- moinmoin
[any material that should appear in print but not on the slide]
3.5 游戏
[any material that should appear in print but not on the slide]
3.6 Web开发
- mod_python
- zope/plone
- karrigell
- cherrypy
- django
- quixote
- snakelets
[any material that should appear in print but not on the slide]
3.7 科学计算
[any material that should appear in print but not on the slide]
3.8 移动开发
- 掌上电脑上的Python
- 手机上的Python Python for s60
[any material that should appear in print but not on the slide]
3.9 嵌入开发
[any material that should appear in print but not on the slide]
3.10 数据库开发
- 标准DB-API接口
- 支持众多数据库
- sqlite
[any material that should appear in print but not on the slide]
四、Python的影响
- Java平台
- Jython
- groovy
- .net平台
- python.net
- IronPython
- boo
[any material that should appear in print but not on the slide]
五、Python的特性
- 运行方式
- 动态绑定
- 面向对象
- 模块和包
- 语言扩展
- 有趣的语法
- 其它
[any material that should appear in print but not on the slide]
6.1 运行方式
[any material that should appear in print but not on the slide]
6.2 动态绑定
[any material that should appear in print but not on the slide]
6.3 面向对象
- 一切皆对象
- 多重继承
- 异常处理
- 垃圾自动回收
- New Style Class和Classic Class
- 操作符/函数重载
- 元类(Metaclass)编程
[any material that should appear in print but not on the slide]
6.4 模块和包
- 将数据与类作为供它人使用的模块
- 对于多文件可以封装成包
- 有专用的打包工具
[any material that should appear in print but not on the slide]
6.5 语言的扩展
- C,C++扩展
- swig, sip
- pyrex
- ctypes
[any material that should appear in print but not on the slide]
6.6 Unicode的支持
[any material that should appear in print but not on the slide]
6.7 有趣的语法
- 缩排
- 高级数据结构
- 变量交换
- 参数缺省值,不定参数与关键字参数
- ...
[any material that should appear in print but not on the slide]
6.8 其它
- 自动编译成字节文件
- 导入时顶层代码自动执行
- 强大的自省能力
- 对象序列化
- ...
[any material that should appear in print but not on the slide]
六、Python的哲学
- Python的哲学--Pythonic
- import this
[any material that should appear in print but not on the slide]
6.1 Zen of Python
蠎禅
优美胜过丑陋 明确胜过含蓄
简单胜过复杂 复杂胜过难懂
扁平胜过嵌套 稀疏胜过密集
易读亦有价
尽管实用会击败纯洁 特例也不能特殊到打破规则
除非明确地使其沉默 错误永远不应默默地溜掉
面对着不确定,要拒绝猜测的诱惑
应该有一个--宁肯只有一个--明显的实现方法
也许这个方法开始不是很明显,除非你是荷兰人
尽管不做通常好过立刻做 但现在做也要胜过不去做
如果实现很难解释,那它就是一个坏想法
如果实现容易解释,那它可能就是一个好想法
名字空间是一个响亮的出色想法--就让我们多用用它们
[any material that should appear in print but not on the slide]
七、如何学习Python
- 实践是检验真理的唯一标准
- 学习开源精神
- 在工作和学习中主动应用
- 订阅邮件列表与人交流
- 参与项目
- 多看源代码
- 勤写作、勤积累
[any material that should appear in print but not on the slide]
八、Python在中国的发展
[any material that should appear in print but not on the slide]
九、Python的一些资源
[any material that should appear in print but not on the slide]
十、问题时间
谢谢!
[any material that should appear in print but not on the slide]