本文介绍了为什么我喜欢Python(警告:漫步)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我一直关注这个小组(有点松散;讨论涉及 其他语言或高级概念让我失望),我看到了所有这些 否定性(OMG Python'的lambda是borken roflol,使用teh othar langauge)。不过,我作为一个相对较新的Python人员,很少注意这些批评。 Python中的一些东西是违反直觉的,是的,但是什么语言没有这样的东西?东西?而且我觉得人们可以在很短的时间内掌握Python的语法 而不是其他许多语言(至少对我来说这是真的)。对于 除了从所有巨魔中休息一下之外没有什么理由,我已经决定我会写b $ b $为什么我喜欢Python。你们中的大多数人都会知道这些事情,但对于 ,其他新手和需要说服的外人......;) 我来自主要是C背景。现在,让我们在这里得到一些东西:我 从来没有真正的工作编程,也没有完成任何大型程序 (不过我做了很多次大部分节目)。但是我仍然用某些语言编写了大量的代码,包括测试和 这样,我也有很多书。 ;)所以我仍然知道我喜欢用什么语言。 以下是我学过的语言:BASIC(几种变体,包括 QBasic ),Visual Basic,C,C ++,D,Small,Java,Python,Turbo Pascal,Perl, 汇编(x86,Z80,6502),总有一三个我忘记。我是想要添加Delphi的,但是我并没有真正了解Turbo Pascal 没有。我接下来可能会学习LISP或Ruby。当然,我比其他人更了解一些 ...我已经忘记了很多Perl和Pascal(但是有些 文档可能就是我所有的'' d需要加快速度。 我实际上是学习C作为C ++的踏脚石,有点......最终我抓住了OOP OOP在我讨厌C ++之前,我已经写了几年的概念并写了完整的C ++。那种语言是怪物。 理解它比看起来更容易。我的高级C ++文本中的一些东西给了我 噩梦。我不是说C ++用户使用C ++或者类似 这样的东西是愚蠢的 - 它不适合我。我在AP计算机科学专业学习了三年 高中(因为它非常简单,并且给了我在学校的时间代码真实的 东西)......他们在书中没有教过的东西让我感到非常害羞(例如,他们的异常处理教学是非常糟糕的)。我仍然使用C ++,实际上我目前的一个项目是将Python嵌入其中,但我不希望必须喜欢它。 :) C ++可能是某些工作的正确语言...我尝试 远离这些工作。 ;) 但是我对C也不满意,作为一种通用语言,因为它在规模的另一端更多的是b 。你必须输入这么多只是为了简单地做一些简单的事情。在C中执行OOP代码是一件麻烦事。不做OOP C中的代码有时会导致缺乏灵活性......这意味着C'不是那个工作的工具,除非你必须拥有超级omega -ultra-fast while while 便携式......我更像是设计师而不是程序员。我喜欢能够思考 的东西而只是输入它。我不想做指针算术,我希望 来实现我的想法。 所以我成了Java坚果一段时间。 Java,当它归结为它时,它需要同时使用C和C ++来修复任何太复杂或太低级别的东西 (然后尝试制作它)便携式)。但它有一些奇怪之处......它想要类型严格的,但如果你想要一个抽象容器,你必须转换为 对象。咦?在我看来,就像在Java中一样,你在使用 低级思维做高级事情。有时候做你想做的事太容易了......其他时候 几乎不可能。再说一遍,我不是在抨击这些语言中的任何一种语言,我只是不想将它们视为通用工具。 我被领导了有时候尝试D( http://www.digitalmars.com/d/)。我总是对它感兴趣并且尝试了最新版本的语言和编译器。没有。 不要点击给我......它似乎与C ++一样精神分裂,无论是在目标上还是在实施中都是b $ b。我一开始喜欢它,但是......不是。 你会注意到这些语言都有一种共同的语法风格和 语义。 C ++基于C,Java间接基于C ++,基于以上所有,D是 。我决定我不喜欢语法和 语义,有一天我需要编写一个脚本来处理文本文件 并吐出结果在另一个文件中,我知道我不想使用 这些语言之一。我决定尝试使用Python。 我已经尝试过学习Perl了。我有点成功了。但Perl's 如此毛茸茸,以至于如果你把它放在森林里,人们就会得到他们明确的证明存在sasquatch的证据。即使我写了 ,我也无法阅读Perl代码。因此,虽然我尊重它,因为我尊重大多数语言,作为一种特定用途的b 语言,我真的不想为此任务而烦恼,因为我想要 尝试使用通用语言,而不是通用语言。语言我 已经知道了。所以Python就是。 哇。 这是我一直想看的语言。糟糕的缩进几乎不存在(如果您已经看过AP计算机科学课堂并且在学生的C ++ / Java代码上看了一下 )显示器,你会惊恐地发出惊恐的声音 一半)。语言和图书馆相得益彰,如果你不能用语言完成它,你可能可以使用(大量) 库。类型变得几乎不重要。简单地说,Python要问程序员这个关键问题:问题的本质是什么? 我很少发现自己在摔跤语言的语法。我觉得我已经掌握了语法和语义,而且我需要的只是 参考手册和Python教程! 我个人觉得性能上的担忧使得C和C ++成为行业标准(Java不会落后因为它看起来像C ++而且它是' 不是那么慢变得越来越没有根据了。这有点具有讽刺意味 我这样说,因为我有一个当前的程序我正在研究Python的地方 对我来说当然运行得太慢了(虽然我正在努力)。但那是一个特殊情况,在这种情况下,数字信号处理。 当然,我仍然有自己的(小)问题与Python 。名字绑定 的方式对我来说有点奇怪,但它对我来说更有意义, 我很快就习惯了,不像一些巨魔^ H ^ H ^ H ^ H ^ H ^ Hpeople我 知道。字符串的不变性也有点奇怪,但我理解为什么 它已经完成了......即所以人们不会不小心这样做: foo =''这是一个字符串'' bar = foo foo [:4] ='''' 打印栏#Prints''这是一个字符串''! 相反,口译员在第3行提供了一个有用的追溯说明 本质''你做不到''。 (然后那些不明白为什么然后会在新闻组上讨论它的人而不是发现foo =''那个'' foo [4:产生预期的结果......)我认为没有任何东西可以阻止任何人制作一个''可变字符串''类,但是,特别是 我们如何从基本类型继承,虽然我不确定 这样做的明智之处。等待。等一下。 [检查以确保标准库没有可变的字符串类...废话! 是:UserString.MutableString,虽然它已被半推荐使用。 :)] 是的。那个图书馆确实拥有一切。 ;)无论如何,为了回到我所说的话,我有一些古怪的东西......但是,嘿,什么语言都没有?...而这些 比我在其他语言中找到的那些奇怪的东西容易让我忍受。 我会说更多但是我已经漫无目的地待了一个晚上/早上/无论现在是什么......现在是时候回到实际编码,然后再睡觉了。 :)我希望我 没有让自己或其他任何人看起来太愚蠢。 - KefI''ve been following the group a bit (somewhat loosely; discussions involvingother languages or advanced concepts kind of lose me), and I see all thisnegativity (OMG Python''s lambda is borken roflol, use teh othar langauge). I asa relative newcomer to Python pay little heed to the criticism, though. A fewthings in Python are counterintuitive, yes, but what language doesn''t have suchthings? And I feel that one can master the syntax of Python in far less timethan one can for many other language (at least this was true for me). Forlittle reason other than to take a break from all the trolls, I''ve decided I''dwrite why I love Python. Most of you will already know these things, but forthe other newbies and the outsiders who need to be convinced...;)I come from mostly a C background. Now, let''s get something straight here: Inever had a real job programming, nor have I ever completed any large programs(however many times I have made large portions of programs). But I''ve stillwritten a substantial amount of code in some languages, including testing andsuch, and I also have many books. ;) So I still know what I like in a language.Here are the languages I''ve learned: BASIC (several variants, includingQBasic), Visual Basic, C, C++, D, Small, Java, Python, Turbo Pascal, Perl,Assembly (x86, Z80, 6502), and there''s always one or three that I forget. I wastempted to add Delp but I didn''t really learn much of it that Turbo Pascaldidn''t have. I probably will learn LISP or Ruby next. Of course, I know some ofthese better than others...I''ve forgotten much of Perl and Pascal (however somedocumentation is probably all I''d need to get up to speed).I actually learned C as a stepping stone to C++, sort of...eventually I graspedthe OOP concepts and had been writing full-fledged C++ for some years before Irealized that I hate C++. That language is a monster. It looks easier tounderstand than it is. Some of the things in my advanced C++ texts give menightmares. I''m not saying C++ users are stupid for using C++ or anything likethat -- it''s just not for me. I was in AP Computer Science for three years inhigh school (because it was so easy, and gave me time at school to code REALstuff)...some of the things that they don''t teach in the book kind of freak meout (their teaching of exception-handling was atrocious, for instance). I stilluse C++, in fact one of my current projects embeds Python into it, but I don''thave to like it. :) C++ may well be the right language for certain jobs...I tryto stay away from those jobs. ;)But I grew dissatisfied with C, too, as a general-purpose language because it''smore on the opposite end of the scale. You have to type so much just to dosomething simple sometimes. And doing OOP code in C is a hassle. Not doing OOPcode in C sometimes leads to inflexibility...meaning C''s not the tool for thatjob, unless you have to have it hyper-omega-ultra-fast while stillportable...I''m more of a designer than a programmer. I like being able to thinksomething and just typing it out. I don''t want to do pointer arithmetic, I wantto just implement my ideas.So I became a Java nut for some time. Java, when it comes down to it, itstaking both C and C++ and fixing anything that is too complex or too low-level(and then trying to make it portable). But it has some oddities...it wants tobe type-strict, but if you want an abstract container, you have to cast toobject. Huh? It looks to me like in Java, you''re doing high-level things usinglow-level thinking. Sometimes it''s too easy to do what you want...other timesit''s near impossible. Again, I''m not bashing any of these languages, I justdon''t like them as general-purpose tools.I was led to try D sometime (http://www.digitalmars.com/d/). I''d always beeninterested in it and tried a recent version of the language and compiler. Nope.Doesn''t click for me...it seems as schizophrenic as C++, both in its goals andin its implementation. I liked it at first, but...nah.You''ll notice that these languages all share a common style of syntax andsemantics. C++ is based on C, and Java is indirectly based on C++, and D isbased on all of the above. I decided I just didn''t like the syntax andsemantics, and one day when I needed to write a script to process a text fileand spit out the result in another file, I knew I didn''t want to use one ofthese languages. I decided to try Python.I''d already tried to learn Perl by this point. I sort of succeeded. But Perl''sso hairy that if you put it in the forest, people will have their definitiveproof of the existence of the sasquatch. I can''t read Perl code even if I wroteit. So while I respect it, as I respect most languages, as a specific-purposelanguage, I didn''t really want to bother with it for this task, as I wanted totry a general-purpose language, other than the "general-purpose" languages Ialready knew. So Python it is.Wow.This is the language I''ve always wanted to see. Bad indentation is nearlynon-existent (if you''ve seen an AP Computer Science classroom and took a lookat the C++/Java code on the students'' monitors, you WILL shriek with horror athalf of it). The language and the library complement each other well, and ifyou can''t do it simply with the language, you probably can with the (massive)library. Types are rendered almost unimportant. Python, to put it simply, asksthe programmer that crucial question: "What is the ESSENCE of the problem?"Rarely do I find myself wrestling with the language''s syntax. I feel I''vemostly mastered the syntax and semantics and I needed little more than theReference Manual and the Python Tutorial!I personally feel that the performance worries that put C and C++ as theindustry standard (with Java not far behind because "it looks like C++ and it''snot THAT slow") are becoming increasingly unwarranted. It''s kind of ironic forme to say this as I have a current program I''m working on where Python iscertainly running too slow for me (though I''m working on that). But that''s aspecial case, in this case, digital signal processing.Of course, I still have my own (minor) issues with Python. The way name bindingworks is kind of odd to me, but it does make sense to me more often than not,and I''m getting used to it quickly, unlike some trolls^H^H^H^H^H^Hpeople Iknow. The immutability of strings is also kind of strange, but I understand whyit''s done...namely so people don''t accidentally do this:foo = ''this is a string''bar = foofoo[:4] = ''that''print bar # Prints ''that is a string''!And instead the interpreter provides a helpful traceback on line 3 saying inessence ''You can''t do that''. (Then people who don''t understand why will thenrail about it on the newsgroup instead of discovering that foo = ''that'' +foo[4:] produces the intended result...) I don''t think there''s anythingpreventing anybody from making a ''mutable string'' class, though, especiallywith how we can inherit from basic types, though I wouldn''t be sure of thewiseness of doing that. Wait. Hold on a minute.[checks to make sure standard library has no mutable string class...crap! Thereis: UserString.MutableString, though it''s semi-deprecated. :)]Yup. That library does have everything. ;) Anyway, to get back to what I wassaying, Python has some oddities...but hey, what language doesn''t?...and theseoddities are a lot easier for me to put up with than the ones I''ve found inother languages.I was going to say more, but I''ve rambled enough for one night/morning/whateverit is now...time to get back to actually coding, and then sleeping. :) I hope Ididn''t make myself, or anybody else, look too foolish.- Kef推荐答案 Ruby是一门优秀的语言,但它不会改变你的方式当你已经认识Python时,想想编程; LISP会。 如果你已经知道Ruby,我可能会说学习Python会不会改变你对编程的看法。尽管如此,在python-list上挂出 会改变你对程序员的看法。 OrenRuby is a great language but it will not change anything in the way youthink about programming when you already know Python; LISP will.If you already knew Ruby I could probably say that learning Python willnot change anything in the way you think about programming. Hanging outon python-list will change the way you think about programmers, though.Oren 这篇关于为什么我喜欢Python(警告:漫步)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 03:43