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


Groups > comp.lang.python > #110965

Re: Lost in descriptor land

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Lost in descriptor land
Date Sat, 2 Jul 2016 17:06:47 -0600
Lines 21
Message-ID <mailman.30.1467500855.2295.python-list@python.org> (permalink)
References <b9c69ca0-a338-41ec-bfa5-b14510e2cb8f@googlegroups.com> <5a7b6360-5b9b-465c-8401-9a0079048931@googlegroups.com> <7b72a3a0-f0c0-429a-b383-5c3dbfdedba5@googlegroups.com> <CALwzidk9AJa0m0086_xKcYearCv34NK8xQ2Q=1SMZv7WbM2yRA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de Fd0rqzeHGNaCz+TiEIZs5wgbwdtJVqYtsmQ0/E0UMkrg==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'friday,': 0.07; 'definition,': 0.09; 'descriptor': 0.09; '2016': 0.16; 'descriptors,': 0.16; 'instantiate': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'say,': 0.18; "shouldn't": 0.18; 'saying': 0.22; 'lawrence': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'define': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; '(it': 0.29; 'classes': 0.30; 'certainly': 0.30; 'checks': 0.30; 'saves': 0.30; 'guess': 0.31; "can't": 0.32; 'class': 0.33; 'instances': 0.33; 'received:google.com': 0.35; 'done': 0.35; 'instance': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'rather': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'jul': 0.72; 'state.': 0.72; 'to:name:python': 0.84; 'utc+5:30,': 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-transfer-encoding; bh=6RNoCGnIvV4mz+kOt+ZZvN0GBmJIvMC/Kw2U3Y390Fs=; b=vIl5Hiz5QMTwXp5G2+L5fu9Ibm7oco+79kglud6ngzjkmUv8LBrzs95Wr88L8E3NHE Is8KFsc9H01qbn4o0Iq8KDjf+/WW0Izy7yuywnVw+ptb8zulcha9kfeCXQ/J38Kdk1iV tSkPZ3/o/Zjz6QELD1Q8iD7xMd5WajOWj4l+2Bp3xYLU7p10ZtlqDYYlP/RlrguUYD4F f7zgW1+TUKNpNcIQzElcKP6WXEVSijRLNSB8qUV4gyh7cgYjSkKEHoA/0pKRQ0xtjhHr b7IWHz5kzbpefM4KRvBSS+hl82uNAeuTr3UdiV+6ZVLl4d3u4yUUtoZDIXpp4JZIYXq+ IbdA==
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:content-transfer-encoding; bh=6RNoCGnIvV4mz+kOt+ZZvN0GBmJIvMC/Kw2U3Y390Fs=; b=U+RlLdDPBeP4YQKqu1WYTpssLoMNQ6IYS0qcwcJvXS7J4FkBl0ahLKIHfdMZ6djUQy jK6E8jqZOZqpjCM4kNL7fA6yas/vU0p8JFIzjpjnQp732Jyxmd/sjKowv1EPgLxjVmvy i+oMtl0j4vZ1kW5L2BvpS7mDaEmTThpqj0Ro8sBoNOC+3O+Ksb5/lBTiS/8B1vT7cvXd F+OO6CfjOTnYmWVKMXFUO63mjXB6pFAmZ62akPpKsRpBL1Hsh5pijbI+KVt1sLJ+p1Dc 4rznl+K+8i5HiW6joOGo9nIFvuwzjKNo+eaDk09zXSVgKiYe4RWR4FK6ejIaUrd6nGI6 cpRA==
X-Gm-Message-State ALyK8tKif7prHEt28evIDtpkTKXwctsiU4o9nRHeYVajaIkAIy6wcrqQy0VfLlTu5OgYdIUJkGeD44Y7J1PI5w==
X-Received by 10.202.244.72 with SMTP id s69mr2659778oih.24.1467500846838; Sat, 02 Jul 2016 16:07:26 -0700 (PDT)
In-Reply-To <7b72a3a0-f0c0-429a-b383-5c3dbfdedba5@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <CALwzidk9AJa0m0086_xKcYearCv34NK8xQ2Q=1SMZv7WbM2yRA@mail.gmail.com>
X-Mailman-Original-References <b9c69ca0-a338-41ec-bfa5-b14510e2cb8f@googlegroups.com> <5a7b6360-5b9b-465c-8401-9a0079048931@googlegroups.com> <7b72a3a0-f0c0-429a-b383-5c3dbfdedba5@googlegroups.com>
Xref csiph.com comp.lang.python:110965

Show key headers only | View raw


On Sat, Jul 2, 2016 at 5:32 AM, Ankush Thakur <ankush.thakur53@gmail.com> wrote:
> On Friday, July 1, 2016 at 9:13:19 AM UTC+5:30, Lawrence D’Oliveiro wrote:
>>
>> > Shouldn't we be instead using self.celcius in, say, __init__() and then
>> > everything will work fine?
>>
>> I guess it might. But this way, using descriptors, all the setup is done once at class definition, rather then every time in class instantiation.
>
> So you're saying the (sole) reason to instantiate descriptor classes at class-level is performance?

Performance might be part of it (it also saves some checks when
looking up attributes), but in my opinion a big reason for it is
separation of responsibilities. Classes define object behavior;
instances contain object state. For example, you can't define a method
on an instance (though you can certainly store a function there and
call it).

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


Thread

Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-06-30 18:06 -0700
  Re: Lost in descriptor land Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-30 19:36 -0600
    Re: Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-07-02 04:27 -0700
  Re: Lost in descriptor land Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 20:33 -0700
    Re: Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-07-02 04:30 -0700
      Re: Lost in descriptor land Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-02 18:02 -0700
        Re: Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-07-03 06:29 -0700
  Re: Lost in descriptor land Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 20:43 -0700
    Re: Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-07-02 04:32 -0700
      Re: Lost in descriptor land Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-02 17:06 -0600
        Re: Lost in descriptor land Ankush Thakur <ankush.thakur53@gmail.com> - 2016-07-03 06:27 -0700
        Re: Lost in descriptor land Steven D'Aprano <steve@pearwood.info> - 2016-07-04 01:32 +1000
          Re: Lost in descriptor land eryk sun <eryksun@gmail.com> - 2016-07-03 23:59 +0000
            Re: Lost in descriptor land Steven D'Aprano <steve@pearwood.info> - 2016-07-04 11:56 +1000

csiph-web