为什么人们还在使用经典课程? [英] why are people still using classic classes?

查看:58
本文介绍了为什么人们还在使用经典课程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到一些ASPN食谱食谱,最近增加了

,使用经典课程。


我也注意到了经典类在

标准库中的许多地方使用。


自从Python 2.2以来我一直在使用新式类,并且很惊讶

人们仍在使用经典课程。


对于我不知道的经典课程是否合法使用?

是否有项目专门将标准库类迁移到

新式类?


Sw。

解决方案

Simon Wittber< si ********** @ gmail.com>写道:

我不知道经典类的合法用途吗?




有没有理由不使用它们?如果一个经典课程运作正常,那么

奖励是否可以转换到新的风格课程?我意识到,(对象)并没有付出很多努力。在你的班级名字之后,但我很懒,而且b $ b不要打扰。我不知道我是怎么受到这种伤害的。


显然,如果有一些新风格的功能我想要

使用,这将是一个不同的故事。


>有没有理由不使用它们?如果经典类工作正常,那么

激励是否可以切换到新的样式类?




也许经典类最终会消失?看起来很奇怪

(很难向同行解释)一种语言提供了两种不同的定义标准类的方法。


Sw。




" Simon Wittber" < SI ********** @ gmail.com>在留言中写道

新闻:ma ************************************ ** @ pyth on.org ...

我注意到一些ASPN食谱配方,这是最近添加的,使用经典课程。
我也注意到经典类在
标准库中的许多地方都使用过。

我从Python 2.2开始就一直在使用新式类,并且很惊讶
是否有合法用于我不知道的经典类?
是否有专门将标准库类迁移到新式课程?


部分原因只是它更容易:你不必从对象继承



AFAIK,没有项目可以迁移标准库,而且我不会确定这是一个好主意,因为现有程序

,当他们继承的
班级突然改变时,会影响经典课程行为。


经典课程将来某个时候会消失,目前

计划用于半神话3.0版本。


John Roth
Sw。




I''ve noticed that a few ASPN cookbook recipes, which are recent
additions, use classic classes.

I''ve also noticed classic classes are used in many places in the
standard library.

I''ve been using new-style classes since Python 2.2, and am suprised
people are still using the classic classes.

Is there a legitimate use for classic classes that I am not aware of?
Is there a project to specifically migrate standard library classes to
new-style classes?

Sw.

解决方案

Simon Wittber <si**********@gmail.com> wrote:

Is there a legitimate use for classic classes that I am not aware of?



Is there a reason NOT to use them? If a classic class works fine, what
incentive is there to switch to new style classes? I realize it''s not
much effort to put "(object)" after your class name, but I''m lazy and
don''t bother. I don''t see how I''ve been hurt by that.

Obviously, if there was some feature of new style classes I wanted to
use, it would be a different story.


> Is there a reason NOT to use them? If a classic class works fine, what

incentive is there to switch to new style classes?



Perhaps classic classes will eventually disappear? It seems strange
(and is difficult to explain to my peers) that a language offers two
different ways to define a standard class.

Sw.



"Simon Wittber" <si**********@gmail.com> wrote in message
news:ma**************************************@pyth on.org...

I''ve noticed that a few ASPN cookbook recipes, which are recent
additions, use classic classes.

I''ve also noticed classic classes are used in many places in the
standard library.

I''ve been using new-style classes since Python 2.2, and am suprised
people are still using the classic classes.

Is there a legitimate use for classic classes that I am not aware of?
Is there a project to specifically migrate standard library classes to
new-style classes?
Part of it is simply that it''s a bit easier: you don''t have to
inherit from object.

AFAIK, there''s no project to migrate the standard library, and I''m
not at all sure that would be a good idea since existing programs
that asssume classic class behavior would be affected when
classes they inherited from suddenly changed.

Classic classes will go away sometime in the future, currently
planned for the semi-mythical 3.0 release.

John Roth
Sw.




这篇关于为什么人们还在使用经典课程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆