本文介绍了我希望python可以做的事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我花了很多时间使用python,而且就个人而言,我觉得它比使用java和c ++这样的语言要好得多,而且还有很多优点。 b $ b仍然是一些有损其优雅和灵活性的东西。我想b $ b我想可能会提到其中一些。我想听听人们对我投诉的看法是什么,我也想听听别人的抱怨。 1.很多关键词(例如:try / except)是严格必要的,并且不能在功能上下文中使用。 这应该是可行的:map(print,mylist) ) 2.没有简单的方法可以在外部扩展现有的类。 它可能,但它不是很好...... 类形状: def __init __(自我,数字,周长): 通过 目前你可以这样做: 形状.__ dict __。更新({ ''triangle'':ClassMethod( lambda self,sideLength:Shape(3,sideLength * 3)) ''square'':ClassMethod( lambda self,sideLength:Shape( 4,sideLength * 4)) }) 我想要一种方法来扩展类,就像我可以定义它一样容易。 3.你无法扩展内置函数(字符串,列表等),你必须继承 他们。 Guido说他不会让我们因为它会产生兼容性问题,并可能打破翻译。也许如果我们有命名空间 功能,这不是一个问题? 4.分配不能在匿名函数内完成。 我认为大多数python程序员都会同意,python强调简单,可读性和一致性。最终,我认为这些东西中的任何一个都不足以证明减少灵活性,语法可变性和多功能性的合理性。我很惊讶 发现Ruby解决了我所有的python投诉,同时实现了与bthon相当的优雅和简洁,并提供了一个 一些创新的附加功能(包括真正的私人,公共和受保护的 方法)。 尽管事实上我不同意这一点哲学背后 prothon,我很高兴看到它,因为它激发了关于语言发展的良好对话 。 (只要那些心智闭合的人也会关闭他们的嘴巴也会闭嘴) 是否有任何强有力的理由说明为什么语言不应该支持 我列出的东西?是否有人知道未来python承诺的功能 版本可以解决或解决我的问题?我认为的任何问题是否真的只是无知的产品?I''ve spent a lot of time using python, and personally, I feel like it isvastly superior when compared to languages like java, and c++, but thereare still a few things that detract from its elegance and flexibility. Ithought I might mention a few of them. I''d like to hear what people thinkof my complaints, and I also like to hear the complaints of others.1. many keywords (eg:try/except) are strictly imperative, and cannot beused in a functional context.this really should be possible: map(print,mylist)2. there is no easy way to extend existing classes externally.its possible, but it aint pretty...class Shape:def __init__(self,numSides, perimeter):passCurrently you can do this:Shape.__dict__.update({''triangle'':ClassMethod(lambda self,sideLength: Shape(3,sideLength*3))''square'':ClassMethod(lambda self,sideLength: Shape(4,sideLength*4))})I want a way to extend a class as easily as I can define it.3. you cant extend the builtins (string,list,etc), you have to inheritthem. Guido says he wont let us because it would create compatabilityissues, and possibly break the interpreter. Maybe if we had namespacefunctionality, that wouldnt be an issue?4. assignments cant be made inside of anonymous functions.I think most python programmers will agree, that python emphasizessimplicity, readability, and uniformity. Ultimately, I dont think that anyof those things are important enough to justify the reduction offlexibility, syntactic mutability, and versatility. I was surprised tofind that Ruby solves all of my python complaints, while achievinggrace and simplicity easily comparable to that of python, and providing afew innovative extras (including real private, public, and protectedmethods).Despite the fact that I disagree with quite a bit of the philosophy behindprothon, I have enjoyed watching it, because it inspires good dialogueabout language development. (as long as those with closed minds keep theirmouths closed as well)Are there are any strong reasons why a language shouldn''t support thethings I list? Is anybody aware of features promised for future pythonversions that solve or nullify my problems? Are any of my perceivedproblems really just products of ignorance?推荐答案 然后你真的更喜欢ruby或smalltalk。如果你正在构建 非平凡的,长寿命的程序,你花费_far_更多时间阅读 代码而不是编写代码。灵活性很重要,但是不需要为了适应口味而做一些事情。混合样式的代码 是最难阅读的代码(除了机器生成的代码之外的)。 我相信句法可变性是一个已经尝试过的想法,并且发现了b $ b。您可以定义的非标准语法越多, 您需要了解更多关于特定代码的信息才能读取它。 $ br /> 至于多功能性,多功能性和灵活性的顶峰 是机器代码(不是那个笨拙的汇编程序)。我已经发现了很多我不会在python中做的事情,其中​​大部分都可以很容易地构建为扩展模块。 我见过太多interlisp和smalltalk代码集,而不是使用彼此的模块。当你为了方便起见修改系统原语 时,很难使用 其他人不会分享你如何的特殊怪癖br /> 修改基本系统。 编写代码超过三十年后,我发现python 有一种语言令人耳目一新系统具有清晰可辨,可信任的可读结构。 很抱歉,如果这篇文章就是这个帖子的话,我会采取巨魔诱饵。 /> - -Scott David Daniels Sc *********** @ Acm.Org 要使Python中的所有功能都可能是一个 h只有美容效果的努力。怎么样定义 例如 def fprint(item): 打印商品 将所有功能定义放在模块中''功能'' 并使用它: 来自功能导入fprint .... map(fprint,mylist) Mit freundlichen Gruessen, 彼得马斯 - -------------------------- ----------------------------------------- 彼得Maas,M + R Infosysteme,D-52070 Aachen,Hubert-Wienen-Str。 24 电话+ 49-241-93878-0传真+ 49-241-93878-20电子邮件 pe********@mplusr.de ------------------------- ------------------------------------------To make everything functional in Python would probably be ahuge effort with cosmetic effects only. What about defininge.g.def fprint(item):print itemputting all functional definitions in a module ''functional''and using it:from functional import fprint....map(fprint, mylist)Mit freundlichen Gruessen,Peter Maas---------------------------------------------------------------------Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplusr.de------------------------------------------------------------------- 可能。 我在一种充满争议的情绪中感受到了。你能说出来吗? 幸运的是,我已经在Python',Ruby'和你的脚趾上踩过:-)Probably.I''m feeling in a controversy-stirring mood. Can you tell?With any luck I''ve trodden on Python''s, Ruby''s and your toes :-) 这篇关于我希望python可以做的事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 15:03