




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
廖海仁 2011.9.15,Python与Perl的简单比较,语言简介,Perl,Python,由C/sed/awk/shell演化而来 适合文本处理、系统管理,不适合操作系统开发、多线程编程,从ABC语言继承而来,主要受Modula-3影响,结合Unix shell与C的习惯 面向对象、解释性、胶水语言,优 点,Perl,Python,强大的正则表达式匹配功能 复杂灵活的数据结构 Unicode支持(相对AWK/C) 自然语言(也是缺点) 智能语言(也是缺点),简单、易学 高层语言 可移植性 面向对象 规范的代码(可读性强) 图形功能(GUI) 数值计算功能(NumPy),缺 点,Perl,Python,自然语言,代码晦涩难懂 智能语言,可能产生臆断,编程陷阱多 不是很优美,很多方法做事,有时让编程者无所适从 动态类型语言,不是很可靠,性能问题 不适合多线程、底层编程、GUI编程 易学难精,强行缩进 运行速度不够快(比较编译型语言) 动态语言、解释型语言,调试困难(Perl不完全是解释型的),创始人,Larry Wall (Perl) Larry Wall,Guido van Rossum(Python),Languist(语言学家) Perl Many ways to accompany the same task Constructs interact in context-sentitive and sometimes quite subtle ways mush like natural language,Mathematician(数学家) Python: High degree of uniformity Orthogonal design,设计理念,Design Principle of Perl,Zen of Python (Tim Peters),Theres More Than One Way To Do It Easy things should be easy, and hard things should be possible,Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases arent special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one- and preferably only one -obvious way to do it. Although that way may not be obvious at first unless youre Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, its a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea - lets do more of those!,Fundamental principles of human language (I),Expressiveness is more important than learnability Its quite OK to speak in “baby talk” if you happen to be a baby A language can be useful even before you have learned the whole language There are often several good ways to say roughly the same thing Every linguistic utterance gets meaning from many contexts at once Effiicent communication requires a certain amount of linguistic complexity Semantic networks do not gennerally map well into orthogonal spaces Shortcuts abound; common expressions should be shorter than uncommon expressions,Fundamental principles of human language (II),Not everything can be easy to express; its OK if some things are hard but possible Languages are naturally punctuated by pauses, intonation, stress, pacing, etc. Healthy culture is more important than specific technology to a languages success Its OK to speak with an accent as long as you can make yourself understood For any living language, evolution is not preventable over the long term Its particularly important for written documents to be evaluated in historical context.,Perl or Python ?,Perl拥护者,Python拥护者,正则匹配的近乎完美语言,You can do everything in Python that you can in Perl, but you can read your code after you do it 简单易学,Perl 6 Vs Python 3,Perl 6,Python 3,Resign of the whole language,Not a total rewrite or a total resign, though a break with backward compatibility,Data Structures,Perl,Python,Scalars Arrays Hashes (Perl treat everything as mutable),Numbers Strings Lists Dictionaries /Sets Tuples (Immutable Lists),关于Python的两个问题,数值与字符串 (对应Perl 之Scalar) 参数传递方式(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年工业互联网平台IPv6技术升级在智能仓储物流领域的应用与部署报告
- 2025年教育行业教育行业企业培训市场前景预测报告
- 2025年美妆行业个性化定制服务模式商业模式创新报告
- 2025年矿山智能化开采无人作业技术在国际市场的应用与发展报告
- 土壤改良剂2025年研发成果在生态农业中的应用鉴定报告
- 2025年旅游地产项目可持续发展与旅游目的地旅游目的地可持续发展规划研究报告
- 2025年直播电商主播影响力深度分析及精准营销策略报告
- 2025年航空货运市场竞争格局分析报告:行业前景与风险预测
- 2025年工业互联网平台NFV网络功能虚拟化在虚拟现实虚拟现实娱乐产业中的应用实践报告
- 2025年模具行业数字化设计仿真技术产业升级与转型报告
- 医院培训课件:《PPD试验》
- 国开电大《应用写作(汉语)》形考任务1-6答案
- 小学生国家文化安全教育
- MOOC 金融学-湖南大学 中国大学慕课答案
- 填写模板-接地装置(含连通或引下线)接头连接记录(表式一)GD3010247
- 城市规划设计计费指导意见(2004年)
- 常见病观察及护理要点
- (高清版)TDT 1059-2020 全民所有土地资源资产核算技术规程
- 成人氧气吸入疗法-中华护理学会团体标准
- 2022年全国统一高考化学试卷和答案解析(全国甲卷)
- 2022年1月上海春季高考英语真题(学生版+解析版+听力音频)
评论
0/150
提交评论