欢迎来到天天文库
浏览记录
ID:21845410
大小:576.50 KB
页数:13页
时间:2018-10-25
《python与perl的简单比较》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、廖海仁2011.9.15Python与Perl的简单比较语言简介PerlPython由C/sed/awk/shell演化而来适合文本处理、系统管理,不适合操作系统开发、多线程编程从ABC语言继承而来,主要受Modula-3影响,结合Unixshell与C的习惯面向对象、解释性、胶水语言优点PerlPython强大的正则表达式匹配功能复杂灵活的数据结构Unicode支持(相对AWK/C)自然语言(也是缺点)智能语言(也是缺点)简单、易学高层语言可移植性面向对象规范的代码(可读性强)图形功能(GUI)数值计算功能(NumPy)缺点PerlPython自然语言,代码晦涩难懂智能语言,可能产生臆断
2、,编程陷阱多不是很优美,很多方法做事,有时让编程者无所适从动态类型语言,不是很可靠,性能问题不适合多线程、底层编程、GUI编程易学难精强行缩进运行速度不够快(比较编译型语言)动态语言、解释型语言,调试困难(Perl不完全是解释型的)创始人LarryWall(Perl)LarryWallGuidovanRossum(Python)Languist(语言学家)PerlManywaystoaccompanythesametaskConstructsinteractincontext-sentitiveandsometimesquitesubtleways–mushlikenaturallangu
3、ageMathematician(数学家)Python:HighdegreeofuniformityOrthogonaldesign设计理念DesignPrincipleofPerlZenofPython(TimPeters)There’sMoreThanOneWayToDoItEasythingsshouldbeeasy,andhardthingsshouldbepossibleBeautifulisbetterthanugly.Explicitisbetterthanimplicit.Simpleisbetterthancomplex.Complexisbetterthancompli
4、cated.Flatisbetterthannested.Sparseisbetterthandense.Readabilitycounts.Specialcasesaren'tspecialenoughtobreaktherules.Althoughpracticalitybeatspurity.Errorsshouldneverpasssilently.Unlessexplicitlysilenced.Inthefaceofambiguity,refusethetemptationtoguess.Thereshouldbeone--andpreferablyonlyone--obvio
5、uswaytodoit. Althoughthatwaymaynotbeobviousatfirstunlessyou'reDutch.Nowisbetterthannever. Althoughneverisoftenbetterthan*right*now.Iftheimplementationishardtoexplain,it'sabadidea. Iftheimplementationiseasytoexplain,itmaybeagoodidea.Namespacesareonehonkinggreatidea--let'sdomoreofthose!Fundamentalp
6、rinciplesofhumanlanguage(I)ExpressivenessismoreimportantthanlearnabilityIt’squiteOKtospeakin“babytalk”ifyouhappentobeababyAlanguagecanbeusefulevenbeforeyouhavelearnedthewholelanguageThereareoftenseveralgoodwaystosayroughlythesamethingEverylinguisticutterancegetsmeaningfrommanycontextsatonceEffiice
7、ntcommunicationrequiresacertainamountoflinguisticcomplexitySemanticnetworksdonotgennerallymapwellintoorthogonalspacesShortcutsabound;commonexpressionsshouldbeshorterthanuncommonexpressionsFundamentalprinciplesofh
此文档下载收益归作者所有