Aahz <[EMAIL PROTECTED]> wrote: ... > >Example: I use usually a very simple classes. When I add "(object)" to > >my class definitions, the code continues to works fine -- plus I have > >new features to use. Why this cannot be done automatically? What could > >be broken in the old code if it was threated so? > > Method resolution order is the primary up-front difference, but > introspective code can also have problems. If you're tired of adding
The crucial difference between the old-style classes and the new ones is about how Python lookups special methods. On an instance of an old-style class, the lookup is on the instance itself: >>> class old: pass ... >>> o=old() >>> o.__str__=lambda:'zap' >>> print o zap while on new-style classes, the lookup is ONLY on the class: >>> class new(object): pass ... >>> n=new() >>> n.__str__=lambda:'zap' >>> print n <__main__.new object at 0x51a4b0> The change is in fact a very important improvement, but it badly breaks backwards compatibility, which explains why it can't be applied automatically (within the 2.* line). Alex -- http://mail.python.org/mailman/listinfo/python-list