Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84684

Re: An object is an instance (or not)?

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 <python-python-list@m.gmane.org>
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 <ned@nedbatchelder.com>
Subject Re: An object is an instance (or not)?
Date Tue, 27 Jan 2015 18:22:00 -0500
References <MPG.2f320f923eedd5a69896a1@nntp.aioe.org>
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 <MPG.2f320f923eedd5a69896a1@nntp.aioe.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18191.1422400930.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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)
>      <class 'type'>
>
> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 21:12 +0100
  Re: An object is an instance (or not)? Ethan Furman <ethan@stoneleaf.us> - 2015-01-27 12:36 -0800
  Re: An object is an instance (or not)? André Roberge <andre.roberge@gmail.com> - 2015-01-27 12:50 -0800
    Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 22:06 +0100
      Re: An object is an instance (or not)? André Roberge <andre.roberge@gmail.com> - 2015-01-27 13:38 -0800
        Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 22:43 +0100
          Re: An object is an instance (or not)? André Roberge <andre.roberge@gmail.com> - 2015-01-27 13:49 -0800
            Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 22:58 +0100
              Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 09:32 +1100
                Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 18:55 +1100
                Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 22:20 +1100
              Re: An object is an instance (or not)? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-27 23:12 +0000
                Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 01:52 +0100
                Re: An object is an instance (or not)? Marko Rauhamaa <marko@pacujo.net> - 2015-01-28 07:25 +0200
                Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 21:53 -0800
                Re: An object is an instance (or not)? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-28 05:57 +0000
                Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 11:48 +0100
      Re: An object is an instance (or not)? random832@fastmail.us - 2015-01-28 00:37 -0500
        Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 19:45 +1100
      Re: An object is an instance (or not)? Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-01-27 21:43 -0800
      Re: An object is an instance (or not)? random832@fastmail.us - 2015-01-28 01:01 -0500
        Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 22:22 -0800
          Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 18:03 +1100
        Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 19:48 +1100
      Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 17:59 +1100
      Re: An object is an instance (or not)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-01-28 20:21 +1300
      Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 18:48 +1100
      Re: An object is an instance (or not)? random832@fastmail.us - 2015-01-28 12:08 -0500
        Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-28 18:29 -0800
  Re: An object is an instance (or not)? Ned Batchelder <ned@nedbatchelder.com> - 2015-01-27 18:22 -0500
    Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 01:17 +0100
      Re: An object is an instance (or not)? Chris Angelico <rosuav@gmail.com> - 2015-01-28 11:30 +1100
        Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 01:35 +0100
          Re: An object is an instance (or not)? alex23 <wuwei23@gmail.com> - 2015-01-28 14:44 +1000
          Re: An object is an instance (or not)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-01-28 23:33 +1300
            Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 22:52 +1100
              Re: An object is an instance (or not)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-01-29 19:22 +1300
                Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-29 18:16 +1100
                Re: An object is an instance (or not)? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-29 08:48 -0700
                Re: An object is an instance (or not)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-01-30 22:07 +1300
                Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-31 10:45 +1100
      Re: An object is an instance (or not)? Ned Batchelder <ned@nedbatchelder.com> - 2015-01-27 21:21 -0500
        Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 18:52 -0800
        Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 20:16 +1100
          Re: An object is an instance (or not)? Chris Angelico <rosuav@gmail.com> - 2015-01-28 21:01 +1100
            Re: An object is an instance (or not)? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-29 14:22 -0800
      Re: An object is an instance (or not)? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-27 19:15 -0700
      Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 20:28 +1100
      Re: An object is an instance (or not)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-01-28 23:33 +1300
    Re: An object is an instance (or not)? Grant Edwards <invalid@invalid.invalid> - 2015-01-28 00:23 +0000
  Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 10:39 +1100
    Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 01:24 +0100
      Re: An object is an instance (or not)? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 12:00 +1100
        Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 02:14 +0100
      Re: An object is an instance (or not)? alex23 <wuwei23@gmail.com> - 2015-01-28 14:47 +1000
        Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 21:23 -0800
        Re: An object is an instance (or not)? random832@fastmail.us - 2015-01-28 00:44 -0500
          Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 20:21 +1100
      Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 20:17 +1100
    Re: An object is an instance (or not)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 20:09 +1100
  Re: An object is an instance (or not)? Chris Angelico <rosuav@gmail.com> - 2015-01-28 10:42 +1100
    Re: An object is an instance (or not)? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 01:31 +0100
  Re: An object is an instance (or not)? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 18:11 -0800

csiph-web