Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'constructor': 0.07; 'obj': 0.09; 'subject:python': 0.14; 'def': 0.14; 'wed,': 0.15; 'a()': 0.16; 'constructor.': 0.16; 'hierarchy.': 0.16; 'inheritance': 0.16; 'subject:class': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'wrote:': 0.16; 'wednesday': 0.18; '>>>': 0.20; 'am,': 0.23; '2015': 0.23; 'header :In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.28; 'classes': 0.30; 'class': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'true.': 0.33; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'functions.': 0.35; 'subject:: ': 0.37; 'to:addr:python.org': 0.39; 'more': 0.62; 'hello!': 0.66; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=sayjsQ/GphjZGdkw2PAxrSv5y/u+dLSt5an68VQYeus=; b=oQ5gAttsrsdwR00nrs8inl+joNs7FUWve8RIh//PP8N8fxup5vizI0+Hf5v0xKCtXZ HTAbcNr5WXhfldAqhsJ9JZef+MulFtRZ6puQZwHNA9RpdiUe/EpXiRodAgbZQejpF6W5 I6jpcOEb5eOwCJm58mUead5eZCDgP6KgXSTNYddwkuroFMejDdHmn8S/VkYsrPWHsUzo f6dtzb/q0UFCrrChleoaON1ltCbSA18iAll2ZG6m2chNKBjB2BWrwt8GLsJVQD8l4YL3 DSGucSmSQxWtx0U9IXivWIR4ewW53m+kakYsc3c8qnnBIPktXw2EBOWS2WSi6U5UUTbm bqTA== X-Received: by 10.50.225.35 with SMTP id rh3mr26912335igc.29.1433339907961; Wed, 03 Jun 2015 06:58:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <871tht6uf6.fsf@elektro.pacujo.net> References: <14976c1b-a620-426f-b529-41a3c04e9c1a@googlegroups.com> <48fc36e9-fa67-45d5-9864-0921b7e819ce@googlegroups.com> <556d931a$0$12991$c3e8da3$5496439d@news.astraweb.com> <556de143$0$13009$c3e8da3$5496439d@news.astraweb.com> <%9mbx.608935$JH2.445461@fx11.am4> <914115ea-0f93-4929-b325-5b3f78f5d9f1@googlegroups.com> <871tht7nc3.fsf@elektro.pacujo.net> <556eb9cd$0$13008$c3e8da3$5496439d@news.astraweb.com> <871tht6uf6.fsf@elektro.pacujo.net> From: Ian Kelly Date: Wed, 3 Jun 2015 07:57:47 -0600 Subject: Re: Everything is an object in python - object class and type class To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433339910 news.xs4all.nl 2890 [2001:888:2000:d::a6]:58896 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91965 On Wed, Jun 3, 2015 at 2:57 AM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: >>> In Python, classes are little more than constructor functions. >> >> [...] >> >> Classes give you an inheritance hierarchy. > > That's encapsulated in the constructor. Not entirely true. >>> class A: ... def say_hi(self): ... print("Hello!") ... >>> class B: ... def say_hi(self): ... print("G'day!") ... >>> obj = A() >>> obj.say_hi() Hello! >>> obj.__class__ = B >>> obj.say_hi() G'day!