Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:not': 0.03; 'definitions': 0.07; 'differently': 0.07; 'exists.': 0.07; 'facilitates': 0.09; 'instance.': 0.09; 'instances.': 0.09; 'objects,': 0.09; 'oop': 0.09; 'oop,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:instance': 0.09; 'python': 0.11; 'def': 0.12; 'language.': 0.14; 'agree.': 0.16; 'arguments:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:)?': 0.16; 'subject:object': 0.16; 'term.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'variable': 0.18; 'all,': 0.19; 'implementing': 0.19; 'slightly': 0.19; '>>>': 0.22; 'programming': 0.22; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; "aren't": 0.24; 'received:comcast.net': 0.24; "i've": 0.25; 'class.': 0.26; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'correct': 0.29; 'words': 0.29; 'code': 0.31; 'are.': 0.31; 'forces': 0.31; 'object.': 0.31; 'produces': 0.31; 'terms.': 0.31; 'class': 0.32; 'know.': 0.32; 'languages': 0.32; 'another': 0.32; '(e.g.': 0.33; 'problem': 0.35; 'subject: (': 0.35; 'classes': 0.35; 'common': 0.35; 'created': 0.35; 'beyond': 0.35; 'objects': 0.35; 'but': 0.35; 'c++': 0.36; 'instances': 0.36; 'object,': 0.36; 'should': 0.36; 'two': 0.37; 'expressed': 0.37; 'sometimes': 0.38; 'to:addr :python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'previous': 0.38; 'does': 0.39; 'itself': 0.39; 'realize': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'is.': 0.60; 'then,': 0.60; 'helps': 0.61; 'term': 0.63; 'charset:windows-1252': 0.65; 'details': 0.65; 'between': 0.67; 'believe': 0.68; 'realized': 0.68; 'study': 0.69; '"not': 0.84; "'object'": 0.84; 'standing': 0.84; 'mistake': 0.91; 'preferred,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: An object is an instance (or not)? Date: Tue, 27 Jan 2015 18:22:00 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: c-50-133-228-126.hsd1.ma.comcast.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422400930 news.xs4all.nl 2880 [2001:888:2000:d::a6]:57421 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84684 On 1/27/15 3:12 PM, Mario Figueiredo wrote: > This is a follow up from a previous discussion in which it is argued > that the following code produces the correct error message terminology, > considering that in Python an object is also an instance. 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. > An instance IS an object. On that we can agree. After all, everything in > Python is an object. Even classes are. We can even pass them as function > arguments: > > >>> class Sub: > pass > > >>> def show(aClass): > print(type(aClass)) > > >>> show(Sub) > > > The problem is that an object isn't always an instance. The word > instance in OOP has a very formal meaning. A common mistake is to believe that "OOP" is a well-defined term. It's not it's a collection of ideas that are expressed slightly differently in each language. > In programming languages in > which the classes aren't fully realized objects, it is ok to speak of > 'instance' and 'object' interchangeably. I don't know what a "not fully realized object" is. > But even then, sometimes the > term 'object instance' is preferred, as a way to separate these > 'instances' from other variable instances that may not be created from > class definitions (e.g. C++ built-in types). > > The fact that in Python classes are objects, should not just eliminate > this distinction. The OOP terminology should exist beyond the language > implementing it. It facilitates discourse and helps transmiting concepts > when describing your ideas to another programmer. And because in python, > classes are of the type 'type' and they exist as fully realized objects, > is no excuse to make a distinction between them and their own fully > realized instances. The language implementation details should not exist > as a way for us to freely reformulate long standing terms. > > Because, from my own study of Python, I've came to realize that the > distinction between objects and instances of objects actually exists. In > Python, class objects cannot participate in OOP, only their instances. What does "participate in OOP" mean? > This is why I say that even in Python, where a class is an object, an > object is not always an instance. The language itself forces that > distinction. -- Ned Batchelder, http://nedbatchelder.com