En Tue, 22 Apr 2008 00:49:27 -0300, AlFire
<[EMAIL PROTECTED]> escribió:
Diez B. Roggisch wrote:
But not everything is a newstyle-class:
class Foo: pass
...
isinstance(Foo, object)
True
isinstance(Foo, type)
False
class Bar(object): pass
...
isinstance(Bar, type)
True
thx for explanation. but more I look at it less and less I like the
notation of new-style-class definition. what is an added value of adding
"(object)" since it is already an object. Any insight?
Read Diez previous post again.
An old-style class is an *instance* of object (as all other objects), but
not a *subclass* of object. It does not *inherit* from object.
A new-style class is both an instance of object and a subclass of object.
It inherits from object. This is what the base (object) means.
Note: I am not a language purist, more a pragmatic who like a good style.
We need *some* way to distinguish new-style classes from old ones. The
(object) base is simple, doesn't require new syntax, and it's true (hmm,
this may be a form of petitio principii)
In Python 3.0, old-style classes are gone, and the (object) is not
necesary: all classes inherit from object.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list