An object is an instance (or not)?
marfig at gmail.com
Wed Jan 28 01:31:06 CET 2015
In article <mailman.18193.1422402146.18130.python-list at python.org>,
rosuav at gmail.com says...
> On Wed, Jan 28, 2015 at 10:22 AM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> > I don't know what the difference is between "object" and "instance". An
> > object is an instance of a class. The two words are interchangeable as far
> > as I know.
> My understanding is that "instance" is meaningless unless followed by
> "of". That is to say, 123.45 is an object, and it is an instance *of*
> the 'float' class. Everything in Python is an instance *of something*,
> so in a sense, you can say that everything is an instance, but that's
> like saying that everything has a color. Sure it does, but you need to
> be more specific.
In programming languages in which class definitions aren't first-class
objects, the terms are in fact used interchangeably. And rightly so,
because an object is in fact always an instance of some class.
Python and a few other languages implement class definitions as first-
class objects. In this case, the distinction between an object and an
instance is actually an implementation detail and comes with its own
semantics. This is why I object to the notion that in Python object =
More information about the Python-list