|
您进来了,您肯定会英文吧
这次我不做其他的,麻烦您们一件事
帮我翻译一篇文章
想必大家都知道一种新型的解释性语言叫python,它轻巧,实用,可移植,极大的减低了程序员的工作的复杂性
著名的程序员Bruce Eckel在他的著作——Thinking In Java的第二版中说:python语言最接近征服程序开发与维护的种种复杂度的目标(但是Bruce Eckel在Thinking In Java第三版中因为种种原因收回了这句话,但是这不能抹去大师对python的喜爱)
另一个与python有关的大师当然是ESR,ESR是我最崇敬的黑客,我认为ESR可以说是开源世界中第二有号召力的人(第一位当然是Linus),ESR在很多地方都表示python语言是他的最爱,并且在他的著作《HOW TO BE A HACKER》中把python列为黑客必需掌握的5种语言,并且是一名黑客应该最先学习的语言
说到这里,ESR还有一篇文章——why python,详细的介绍了他认识python的过程,从不屑一顾到爱不释手,文中把python同其他语言进行了对比(包括perl,lisp,c/c++)文章是学习python了解python的瑰宝
我今天请大家的任务就是这个,Why python只有一个英文版本和一个翻译得感觉不那么好的中文版本(翻译人是chaox,我没有贬低他劳动成果的意思,我感谢他对黑客文化做的贡献)所以我想翻译一个比较好的中文版本,但是文章比较长,加上我的英文水平实在有限,所以我想请全卡饭的朋友一起来翻译
1.不用你翻译多少,随便选择一点翻译一下,以附件形式传上来,注明翻译的位置(或者用过QQ(499855641)或者邮箱javer821@gmail.com)
2.我也没有什么奖品,只能代表全体黑客(或许我没有这个资格)感谢您
3.您尽量翻译别人翻译得少的,我从您们翻译中选择最佳最易理解的版本 我在附件中上传英文版(约3000个单词)和已有的中文版
英文版:http://blog.chinaunix.net/u1/37994/showart_331571.html
已有中文版:http://wiki.woodpecker.org.cn/moin/WhyPython/WhyPythonZh
插入紧急任务,本想在下午完成翻译的第一个版本,现在我自己完成大多数,ANDERSON997帮我完成了LISTING 4,只有listing2了,谁帮我下,我直接贴上来 Python could then evaluate the fetchmail --configdump output and have the configuration available as the value of the variable ``fetchmail''.
This wasn't quite the last step in the dance. What I really wanted wasn't just for fetchmailconf to have the existing configuration, but to turn it into a linked tree of live objects. There would be three kinds of objects in this tree: Configuration (the top-level object representing the entire configuration), Site (representing one of the sites to be polled) and User (representing user data attached to a site). The example file describes five site objects, each with one user object attached to it.
I had already designed and written the three object classes (that's what took four days, most of it spent getting the layout of the widgets just right). Each had a method that caused it to pop up a GUI edit panel to modify its instance data. My last remaining problem was somehow to transform the dead data in this Python initializer into live objects.
I considered writing code that would explicitly know about the structure of all three classes and use that knowledge to grovel through the initializer creating matching objects, but rejected that idea because new class members were likely to be added over time as the configuration language grew new features. If I wrote the object-creation code in the obvious way, it would be fragile and tend to fall out of sync when either the class definitions or the initializer structure changed.
What I really wanted was code that would analyze the shape and members of the initializer, query the class definitions themselves about their members, and then adjust itself to impedance-match the two sets.
This kind of thing is called metaclass hacking and is generally considered fearsomely esoteric--deep black magic. Most object-oriented languages don't support it at all; in those that do (Perl being one), it tends to be a complicated and fragile undertaking. I had been impressed by Python's low coefficient of friction so far, but here was a real test. How hard would I have to wrestle with the language to get it to do this? I knew from previous experience that the bout was likely to be painful, even assuming I won, but I dived into the book and read up on Python's metaclass facilities. The resulting function is shown in Listing 3, and the code that calls it is in Listing 4.
[ 本帖最后由 JY-YZX714 于 2009-7-12 16:09 编辑 ] |
|