TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python Programming for the Privileged Class

33 点作者 skfroi将近 11 年前

8 条评论

jmpeax将近 11 年前
One of the best type features of Go is the lack of need to do something like this: "@implements(IEatable)". If a class implements all of the methods of the interface, then it automatically implements that interface. Yuppy seems like a step backwards in OO in this regard.
评论 #7828313 未加载
评论 #7828355 未加载
asdfologist将近 11 年前
Perhaps this is an unpopular opinion, but I think the Duck typing philosophy of Python is a feature, not a bug. Imposing the verbosity and rigidity of Java-style OO onto Python seems like a step backwards to me.
siliconc0w将近 11 年前
I feel like one of the merits of python is the looseness of classes and multiple inheritance. You get the benefits of OO without some of the pitfalls. Sure, you can go through the effort of defining an abstract class but it often isn't needed since your object is often composed of a bunch of separate objects - dealing with a formal contract to some 'abstract' version of your object just adds boilerplate and ends up creating convoluted class hierarchies.
dsymonds将近 11 年前
I can't tell whether this is serious or it's a parody. I'm leaning towards the latter given the title, but it's hard to tell.
评论 #7828438 未加载
woadwarrior01将近 11 年前
This is very reminiscent of zope.interface used in Twisted. I wouldn&#x27;t want to argue for or against it, but I&#x27;ve had times when something like this might have been useful in large code bases.<p>[1]: <a href="http://docs.zope.org/zope.interface/" rel="nofollow">http:&#x2F;&#x2F;docs.zope.org&#x2F;zope.interface&#x2F;</a> [2]: <a href="http://twistedmatrix.com/documents/14.0.0/core/howto/components.html" rel="nofollow">http:&#x2F;&#x2F;twistedmatrix.com&#x2F;documents&#x2F;14.0.0&#x2F;core&#x2F;howto&#x2F;compone...</a>
Myrmornis将近 11 年前
It would be very helpful to add to the README a section explaining what problems this solves. So examples of conventional python classes exhibiting weaknesses that are improved by using yuppy features.
TTPrograms将近 11 年前
I love Python and I love interfaces, so this appeals to me.
评论 #7828257 未加载
X-Istence将近 11 年前
This greatly reminds me of zope.interface!