O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Classic Classes

Python 2.1 and earlier versions implemented classes using a different mechanism than what is currently used. However, these old-style or classic classes are still supported for backward compatibility. A classic class is defined whenever a class does not inherit (directly or indirectly) from object. For example:

class A:                     # A classic class
    def __init__(self,x):
        self.x = x

class B(A): pass             # A classic class--inherits from A

Almost all the basic principles discussed in this chapter apply to classic classes. However, these classes are somewhat more limited in their features. The following list briefly outlines some of the differences.

  • Classic classes do not define new types. In fact, the type of all instances regardless of class is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required