An object is an instance (or not)?
marfig at gmail.com
Wed Jan 28 01:35:07 CET 2015
In article <mailman.18195.1422405040.18130.python-list at python.org>,
rosuav at gmail.com says...
> On Wed, Jan 28, 2015 at 11:17 AM, Mario Figueiredo <marfig at gmail.com> wrote:
> > Means the object is capable of participating in inheritance and/or
> > polymorphism. An instance of an object is capable of doing so, per its
> > class definitions. Whereas a Python class object is not.
> > >>> class Master:
> > def func(self):
> > pass
> > >>> class Sub(Master):
> > pass
> > >>> Sub.func()
> > TypeError: func() missing 1 required positional argument: 'self'
> I have no idea what you're proving here. You just showed that the
> class has a function attached to it, and you didn't provide enough
> arguments to it. And types have their own set of attributes and
I admit it was a contrived example. I couldn't think of a way to
demonstrate that a class object does not participate in its own
inheritance rules. Only instances of it can.
More information about the Python-list