By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

new style and classic style classes ?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.