Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'skip:[ 20': 0.04; 'definitions.': 0.07; 'arguments': 0.09; 'attributes': 0.09; 'inherited': 0.09; 'subject:instance': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'jan': 0.12; "'__doc__',": 0.16; 'argument:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inheritance': 0.16; 'positional': 0.16; 'subject:)?': 0.16; 'subject:object': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'pass': 0.26; 'header :In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'class': 0.32; 'not.': 0.33; 'subject: (': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'object,': 0.36; 'doing': 0.36; "didn't": 0.36; 'so,': 0.37; 'being': 0.38; 'enough': 0.39; 'most': 0.60; "you're": 0.61; 'provide': 0.64; 'capable': 0.67; '2015': 0.84; 'whereas': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=OaaLEwKkRpf6spf7GIuQDIC140qhUJeMhs19cS+GVUI=; b=s01j22IAaP2h9EkABccgdGHMkEB2VmPtvaCt9/WzJO9Iv0Lq1rHa2MR6EEiYsdFkYu d5htVftlGs2TNEW+UCMNM7AZJAxEcz/855a7wwJ7JBtvIal/GbaYNmqWBX/ls/TtlKEF XpzNJJyGUIB02/+ZdKXmYhJk9VDPJ/aJQaskBFRXsGDZOoa+kbifV4GDEipAhhdWW+BU 27JTqnKz8mD2yJJ07C1i9J33kUpjdEJdgOus7OVP3NrRobryJVm+docxvumOqwoZajVi jox1603tnzamM8xifVQI6vkK1VsTwfenVc/TYuqViOOfxmZo/RyhQUEAIVE432RxfDUz 5LZw== MIME-Version: 1.0 X-Received: by 10.50.79.196 with SMTP id l4mr748374igx.14.1422405032109; Tue, 27 Jan 2015 16:30:32 -0800 (PST) In-Reply-To: References: Date: Wed, 28 Jan 2015 11:30:32 +1100 Subject: Re: An object is an instance (or not)? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422405040 news.xs4all.nl 2868 [2001:888:2000:d::a6]:35726 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84691 On Wed, Jan 28, 2015 at 11:17 AM, Mario Figueiredo 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' > > But somehow I think you knew the answer to all these questions and were > instead being snarky. 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 methods: >>> dir(type) ['__abstractmethods__', '__base__', '__bases__', '__basicsize__', '__call__', '__class__', '__delattr__', '__dict__', '__dictoffset__', '__dir__', '__doc__', '__eq__', '__flags__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__instancecheck__', '__itemsize__', '__le__', '__lt__', '__module__', '__mro__', '__name__', '__ne__', '__new__', '__prepare__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasscheck__', '__subclasses__', '__subclasshook__', '__text_signature__', '__weakrefoffset__', 'mro'] Most of those are inherited from object, but some aren't. What are you demonstrating? ChrisA