Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Being against torture ought to be sort of a bipartisan thing." -- Karl Lehenbauer


devel / comp.lang.python / Re: Definition of "property"

SubjectAuthor
o Re: Definition of "property"Eryk Sun

1
Re: Definition of "property"

<mailman.448.1622433403.3087.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13470&group=comp.lang.python#13470

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: eryk...@gmail.com (Eryk Sun)
Newsgroups: comp.lang.python
Subject: Re: Definition of "property"
Date: Sun, 30 May 2021 22:56:40 -0500
Lines: 31
Message-ID: <mailman.448.1622433403.3087.python-list@python.org>
References: <5BD50721-94C9-472B-B7AC-6A16EB13941A@furrypants.com>
<0beeb614-3755-3601-e1ec-6cfb9f20d995@stoneleaf.us>
<CACL+1as+==d719=Ni1w8cdfXgPM3WbQX-5Jd6W8aoRvEBxFK5w@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 ems/HAa5O9Vu7Sa/elRDRAJdimzSODbFIG32qEKpPDug==
Return-Path: <eryksun@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=qpEw2Haf;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.026
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; '(e.g.': 0.04;
'properties': 0.09; 'skip:` 10': 0.09; 'url:reference': 0.09;
'looks': 0.11; '(from': 0.16; 'does,': 0.16; 'ethan': 0.16;
'instance': 0.16; 'received:209.85.215': 0.16;
'received:209.85.215.171': 0.16; 'received:mail-
pg1-f171.google.com': 0.16; 'right.': 0.16; 'sufficient.': 0.16;
'wrote:': 0.16; 'python': 0.16; 'name.': 0.20; 'to:addr:python-
list': 0.23; 'cannot': 0.24; 'creating': 0.27; 'but': 0.31;
'message-id:@mail.gmail.com': 0.33; 'header:In-Reply-To:1': 0.33;
'particular': 0.34; 'same': 0.34; 'received:google.com': 0.34;
'example,': 0.35; 'following': 0.35; 'code:': 0.35;
'from:addr:gmail.com': 0.35; 'two': 0.37; "that's": 0.37;
'special': 0.37; 'received:209.85': 0.38; "it's": 0.38;
'received:209': 0.38; 'url-ip:151.101.36.223/32': 0.38; 'url-
ip:151.101.36/24': 0.38; 'means': 0.40; 'common': 0.60; 'model':
0.60; 'types': 0.63; 'above': 0.65; 'spam': 0.66; 'implemented':
0.69; 'easy': 0.75; 'attribute': 0.84; 'contrast,': 0.84;
'examines': 0.84; 'type,': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-transfer-encoding;
bh=so6W17dqjQwsO/6HQgrfhJZG3qId5NkAJyvacvRk/8Y=;
b=qpEw2HafNrIT8ezBQucrwc9WtUjYQ4UrIzmKSHrIdCL6LMmUM8IbhXm6y9NcRmba4G
OtEbJuWmFgCWQJduLP5ysXxfaaf2PSHJu4NrObI6SNESIuqykHhJZl84/WAhNIm/wPBm
GuoJGhiyC3L4a85e4xD4EybAiWC1GUZ2zBQwh+O95VkSfNX104kqzHBedonFcz/OKEhE
5qhs9UoEGNKg5sqg395E/N/cdh8GvKm1mtQxRwm+zssFsiSW/aTCWQLYy1CXbthAdqi+
xlWpFvhyKfQR93xt911dE+BJes1pA2+uAdgTgeiaxlog7cFO22SJTvWDccPG4P18UbdU
6Eow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to:content-transfer-encoding;
bh=so6W17dqjQwsO/6HQgrfhJZG3qId5NkAJyvacvRk/8Y=;
b=eh94wlrUFsr+deiwd2nicI3ou5LyRcegQQe7lfsX8tWJmnp0+lBM9dIjVbao2tn1Dz
W7etZiBxKz99qpGGqjhPS9F9Ja4MUvtnFIyoGU8bZNUjrj4PDt5el6qxKvmVPbEqITHq
cdJW4ifzan0dH4Gy+tF24WUyZy/TTFmKGczrw66W/XMW2InrTQKHOaHMrzQoecgtLhDX
vVWwtIz9Nc+wx5pDBY1sbi1zRD3p+cTKgbEKltayIb2xJIu7lGnIxZ2pBhjOYSaDSkTi
R0NSsKjjK7bpqnGY84AB+HgC5/PTg/KI+0IPnF1MWfrG9DC0PzpD0aTmnGIg+fUxHpxg
lwBw==
X-Gm-Message-State: AOAM530seDJIgKbpAFKMrztNz2LuzZgKHtXgr0/l7zMwXbgW/xl+EWpt
BFaiyfkv6qBdv7sDdGI80XR1fzVzfjMVRXsmXLSNkT1i
X-Google-Smtp-Source: ABdhPJybKUsttltKZUEc2DMZfKOQHMO644r/ckj8dhrfAx8JckiZy29Eolw/YzF9NMYAjjZiAT7xP1p1h0qAW1eVVtc=
X-Received: by 2002:a05:6a00:1350:b029:2e9:ac26:a5ba with SMTP id
k16-20020a056a001350b02902e9ac26a5bamr9144667pfu.15.1622433400644; Sun, 30
May 2021 20:56:40 -0700 (PDT)
In-Reply-To: <0beeb614-3755-3601-e1ec-6cfb9f20d995@stoneleaf.us>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <https://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: <CACL+1as+==d719=Ni1w8cdfXgPM3WbQX-5Jd6W8aoRvEBxFK5w@mail.gmail.com>
X-Mailman-Original-References: <5BD50721-94C9-472B-B7AC-6A16EB13941A@furrypants.com>
<0beeb614-3755-3601-e1ec-6cfb9f20d995@stoneleaf.us>
 by: Eryk Sun - Mon, 31 May 2021 03:56 UTC

On 5/30/21, Ethan Furman <ethan@stoneleaf.us> wrote:
>
> > Properties are a special kind of attribute. Basically, when Python
> encounters the following code:
> >
> > spam = SomeObject()
> > print(spam.eggs)
> >
> > it looks up eggs in spam, and then examines eggs to see if it has a
> __get__, __set__, or __delete__
> > method — if it does, it's a property.

The above is not quite right. Having a __get__ method is not
sufficient. In the quoted example, the `eggs` attribute of the
SomeObject type has to be a data descriptor type, which means it
defines a __set__ and/or __delete__ method. A computed attribute
that's implemented by a data descriptor type cannot be overridden by
an instance attribute of the same name. In contrast, a non-data
descriptor type only defines a __get__ method (e.g. the `function`
type is a non-data descriptor). A computed attribute that's
implemented by a non-data descriptor type will be overridden by an
instance attribute of the same name. The two common data descriptor
types are `property` and `member_descriptor` (from __slots__), but
creating custom data descriptor types is easy to implement.

See "customizing attribute access" in the data model documentation,
and in particular "implementing descriptors" and "invoking
descriptors":

https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor