471,594 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

new style and classic style classes ?

Hello,
Please put some light on, What are new style classes and classic style
classes in python. The basic differences in them. And How can I decide
to choose one.

Dec 22 '05 #1
1 1299
ankit <an************@gmail.com> wrote:
Hello,
Please put some light on, What are new style classes and classic style
classes in python. The basic differences in them. And How can I decide
to choose one.


"Classic" (old-style) classes are ones with no ancestor classes that are
built-in types; "new-style" classes are one with ancestor classes that
are built-ins (including the built-in type 'object', which exists for
the sole purpose of making classes new-style). New-style classes have a
clearer and better organized approach to attribute access, and allow you
to use such powerful features as 'property' to full effect.

Old-style classes exist only for backwards compatibility. The only good
reason to decide to make a class old-style is when you're making an
*exception* class, specifically: up to Python 2.4, exception classes
must be old-style.
Alex
Dec 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by David MacQuigg | last post: by
5 posts views Thread by Chris S. | last post: by
4 posts views Thread by Isaac Rodriguez | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.