Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Times where one would use new style classes vs classic classes

Reply
Thread Tools

Times where one would use new style classes vs classic classes

 
 
Quek
Guest
Posts: n/a
 
      07-03-2008
Hi all,

I'm really new to Python and I've been reading up some texts on older
versions of Python (2.2 to be specific).

The text briefly mentioned new style and classic classes.

I'd really like to know in the current context of Python 2.5, besides
in the cases of multi-inheritance, where would I use new style
classes? Is it a norm to use more new style classes even if I don't
have multi-inheritance in the industry, open source projects, etc
today?

If this isn't the right place to ask these questions, could some one
point me somewhere more appropriate?

Thanks a lot.
 
Reply With Quote
 
 
 
 
Daniel Fetchinson
Guest
Posts: n/a
 
      07-03-2008
> I'm really new to Python and I've been reading up some texts on older
> versions of Python (2.2 to be specific).
>
> The text briefly mentioned new style and classic classes.
>
> I'd really like to know in the current context of Python 2.5, besides
> in the cases of multi-inheritance, where would I use new style
> classes? Is it a norm to use more new style classes even if I don't
> have multi-inheritance in the industry, open source projects, etc
> today?
>
> If this isn't the right place to ask these questions, could some one
> point me somewhere more appropriate?


As a general rule one always uses new style classes. In fact, in
python 3.0 old style classes will cease to exist which fact alone
justifies their abandonment from 2.x code too.

Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
 
Reply With Quote
 
 
 
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      07-03-2008
Quek a écrit :
> Hi all,
>
> I'm really new to Python and I've been reading up some texts on older
> versions of Python (2.2 to be specific).
>
> The text briefly mentioned new style and classic classes.
>
> I'd really like to know in the current context of Python 2.5, besides
> in the cases of multi-inheritance, where would I use new style
> classes?


Everywhere you don't have to support compat with ages-old versions of
Python. MI is not the main point of newstyle classes (FWIW, you can do
MI with old-style classes too), they have quite a lot more to offer.
Consider "classic" classes as a legacy feature, period.

 
Reply With Quote
 
Quek
Guest
Posts: n/a
 
      07-03-2008
On Jul 3, 3:11*pm, Bruno Desthuilliers <bruno.
(E-Mail Removed)> wrote:
> Quek a écrit :
>
> > Hi all,

>
> > I'm reallynewto Python and I've been reading up some texts on older
> > versions of Python (2.2 to be specific).

>
> > The text briefly mentionednewstyleand classic classes.

>
> > I'd really like to know in the current context of Python 2.5, besides
> > in the cases of multi-inheritance, where would I usenewstyle
> > classes?

>
> Everywhere you don't have to support compat with ages-old versions of
> Python. MI is not the main point of newstyle classes (FWIW, you can do
> MI with old-styleclasses too), they have quite a lot more to offer.
> Consider "classic" classes as a legacy feature, period.


Thanks everyone.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When to use std::pow(x,n) instead of times x for n times? Peng Yu C++ 17 09-14-2008 04:10 PM
Why do so many new style ansi streams and files etc, still use old style strings? Kza C++ 4 03-03-2006 07:00 PM
new style and classic style classes ? ankit Python 1 12-22-2005 08:34 AM
Classic and New Style Classes? Chris S. Python 5 06-24-2004 02:46 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM



Advertisments