Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Promoting Python Date: Thu, 7 Apr 2016 00:56:18 -0600 Lines: 45 Message-ID: References: <87h9ffgdtr.fsf@elektro.pacujo.net> <87zit6lt8q.fsf@elektro.pacujo.net> <87wpoak0f7.fsf@elektro.pacujo.net> <87mvp6jyoi.fsf@elektro.pacujo.net> <87egaijwuy.fsf@elektro.pacujo.net> <87wpoaiedl.fsf@elektro.pacujo.net> <57059E6D.8070105@roce.be> <87r3eihqvx.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de njQZPj4AzrMmFG3gmRcqLgG7rRwKeTz9i+o76lWI6SNg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; 'attributes': 0.07; 'def': 0.13; 'thu,': 0.15; "'ok')": 0.16; '12:30': 0.16; '2016': 0.16; 'button(self,': 0.16; 'over:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'say)': 0.16; 'wrote:': 0.16; 'attribute': 0.18; 'example.': 0.18; 'latter': 0.22; 'title,': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'object,': 0.27; 'skip:e 30': 0.27; 'yield': 0.27; 'function': 0.28; 'regular': 0.29; 'dialog': 0.29; 'oop': 0.29; 'received:209.85.213.174': 0.29; 'supposed': 0.31; 'skip:s 30': 0.31; 'skip:_ 10': 0.32; 'class': 0.33; 'url:python': 0.33; '(for': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'instance': 0.35; 'set.': 0.35; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'received:209.85.213': 0.37; 'difference': 0.38; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'url:3': 0.60; 'different': 0.63; 'you.': 0.64; 'between': 0.65; 'or:': 0.84; 'to:name:python': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.91 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; bh=JSXj6eNdS6J+AJt1kcswATU5OusM7SniY6762swKyGw=; b=K/dV4sNcvT29uqH3OCadn4i3oypJxoUXp0oFjNjBam/MFMCXFGNVKQM5KntRs5S40e wU4GTgUWIUeSjlasY2QQ08JH6uvhbHVvtQdXCrATFetHUyLhjws6NmUuc51zJSyU4ona a18RnFWxsoYry9CKnWGTa6vtw5gmcL6y8cYLrj0uFzobYRih2fnvJeVg+rSWBY5lo7P9 gsCmvlY/hOJBTEyuUE4SF4KOF1W3wsvymJpjHOyUj7YtlpsVR7IKstRlDn2xvi7u0eYz cLlP8ip4dazTZFjou+b/hMKMuo4LiS2Dlv84rt7ZHU3T66bjGfMZQOIOyrz4yE4TLakZ y5Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=JSXj6eNdS6J+AJt1kcswATU5OusM7SniY6762swKyGw=; b=GsLMUSVxl8bDQFT19p5KMYiA3+9WyKPBJ8ieZRvVPgjAvbJQq0S6uKfkWx27lrlCaV PgkJ4CobirSs3kW29K8bmgPOSwjF4IAv00D0CXrgpaiAEAtQ0NRQf/GDj6vDUtj9cn9f W0pLfuI5amThxfLMYyNlExcuSmX7Jjo9XR5FRsCn63vfyR8J2nBY65x0CM2MEWCXN/D5 R5vh9SQbdm4ANCwAzILc5s+kTQXGJrJ2M0prqL08KESQ5fvcUCURrMSSnhAB6xJQ1lw6 n8LTfaR6zxWoYJP/FEmvJo6SJZDELU9frb+At7Lw8vZ08eTWsA2+cqcJGVI6FcNP//tU +XdQ== X-Gm-Message-State: AD7BkJLydbul+QIz34yNi2DAzZt2EgW2H6fujCK1cJXodIvb+lJJjqtp1qD46aRR4vBj9JpxCO1yQImj26CTxw== X-Received: by 10.50.72.107 with SMTP id c11mr1777306igv.85.1460012218124; Wed, 06 Apr 2016 23:56:58 -0700 (PDT) In-Reply-To: <87r3eihqvx.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <87h9ffgdtr.fsf@elektro.pacujo.net> <87zit6lt8q.fsf@elektro.pacujo.net> <87wpoak0f7.fsf@elektro.pacujo.net> <87mvp6jyoi.fsf@elektro.pacujo.net> <87egaijwuy.fsf@elektro.pacujo.net> <87wpoaiedl.fsf@elektro.pacujo.net> <57059E6D.8070105@roce.be> <87r3eihqvx.fsf@elektro.pacujo.net> Xref: csiph.com comp.lang.python:106617 On Thu, Apr 7, 2016 at 12:30 AM, Marko Rauhamaa wrote: > Or: > > When a class attribute reference (for class C, say) would yield a > class method object, it is transformed into an instance method object > whose __self__ attributes is C. > etattr__#the-standard-type-hierarchy> > > So the only difference between a regular function and an instance method > object is the fact that the latter has a __self__ attribute set. > > Although even that small difference can be paved over: > > def g(): > print("g") > g.__self__ = a > a.f = g What is this example supposed to accomplish? Functions don't merely not have a __self__ attribute set. The __self__ attribute has no meaning on a function. Let's take a different example. class Dialog(Window): def __init__(self, parent, title, ok_callback): super().__init__(parent, title) self._ok_callback = ok_callback self._ok_button = Button(self, 'Ok') self._ok_button.bind(self._ok_callback) def f(event): print("Hello world") dialog = Dialog(None, "Example", f) dialog.show() Are you suggesting that dialog._ok_callback should be considered a method of Dialog, despite the fact that the implementation of Dialog and the implementation of f are entirely unrelated? If so, then I think that most OOP practitioners would disagree with you.