Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

That does not compute.


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

SubjectAuthor
o Re: Definition of "property"Barry Scott

1
Re: Definition of "property"

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry Scott)
Newsgroups: comp.lang.python
Subject: Re: Definition of "property"
Date: Sun, 30 May 2021 19:29:15 +0100
Lines: 59
Message-ID: <mailman.426.1622399364.3087.python-list@python.org>
References: <5BD50721-94C9-472B-B7AC-6A16EB13941A@furrypants.com>
<1290014D-2178-480C-AE28-BB52B29A2C16@barrys-emacs.org>
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\))
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de ah/TR7JmEQs18A4jI8zrTQrBDySr8IAIjIcSLV7JxPAA==
Return-Path: <barry@barrys-emacs.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; '(for': 0.05;
'explanation': 0.07; 'mechanism': 0.07; 'url:mailman': 0.09;
'apparently': 0.09; 'attempts': 0.09; 'barry': 0.09; 'cc:addr
:python-list': 0.09; 'from:addr:barry': 0.09; "hasn't": 0.09;
'properties': 0.09; 'received:217.70': 0.09; 'received:gandi.net':
0.09; 'received:mail.gandi.net': 0.09; 'usable': 0.09; 'cc:no real
name:2**0': 0.13; 'behaviour': 0.16; 'from:addr:barrys-emacs.org':
0.16; 'from:name:barry scott': 0.16; 'irv': 0.16; 'kalb': 0.16;
'message-id:@barrys-emacs.org': 0.16; 'times,': 0.16; 'wrote:':
0.16; 'url:listinfo': 0.16; 'python': 0.16; 'api': 0.18;
'cc:addr:python.org': 0.19; 'url-ip:188.166.95.178/32': 0.20;
'url-ip:188.166.95/24': 0.20; "i've": 0.22; 'url-ip:188.166/16':
0.23; 'classes': 0.23; 'object': 0.23; 'written': 0.24;
'examples': 0.26; 'tried': 0.26; 'cc:2**0': 0.27; 'function':
0.28; 'url-ip:188/8': 0.29; 'but': 0.31; 'looked': 0.31; "i'm":
0.32; 'header:In-Reply-To:1': 0.33; 'functions': 0.34; 'hold':
0.34; 'setting': 0.34; 'book': 0.35; 'trying': 0.36; 'two': 0.37;
'change': 0.37; 'going': 0.38; 'word': 0.38; 'use': 0.38; 'does':
0.38; 'someone': 0.39; 'simple': 0.40; 'light': 0.60; 'copy':
0.61; 'best': 0.61; 'here': 0.62; 'received:217': 0.68; 'clear.':
0.69; 'combination': 0.69; 'little': 0.75; 'points': 0.84;
'attribute': 0.84; 'bulb': 0.84; 'articles': 0.86; 'property':
0.88; 'hidden': 0.95
In-Reply-To: <5BD50721-94C9-472B-B7AC-6A16EB13941A@furrypants.com>
X-Mailer: Apple Mail (2.3654.100.0.2.22)
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: <1290014D-2178-480C-AE28-BB52B29A2C16@barrys-emacs.org>
X-Mailman-Original-References: <5BD50721-94C9-472B-B7AC-6A16EB13941A@furrypants.com>
 by: Barry Scott - Sun, 30 May 2021 18:29 UTC

> On 30 May 2021, at 17:57, Irv Kalb <Irv@furrypants.com> wrote:
>
> I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.
>
> I understand what a "property" is, how it is used and the benefits, but apparently my explanation hasn't made the light bulb go on for my editor. The editor is asking for a definition of property. I've looked at many articles on line and a number of books, and I haven't found an appropriate one yet.
>
> I have written some good examples of how it works, but I agree that a definition up front would be helpful. I have tried a number of times, but my attempts to define it have not been clear. Perhaps the best I've found so far is from the Python documentation:
>
> A property object has getter, setter, and deleter methods usable as decorators that create a copy of the property with the corresponding accessor function set to the decorated function.
>
> But I'm hoping that someone here can give me a more concise (one or two sentence) definition of the word "property".
>
> (I would like to avoid going through the whole derivation with the property function, as that would distract from the points that I am trying to make.)

How does this sound?

An object is the combination of behaviour and state.

Classes define the object.
Methods allow the control of behaviour.
Properties hold the state.

The use of getter functions allows a property's value to be calculated.
The use of setting functions allows a property change to update the state an object.

The python property mechanism allows the getting and setter to be hidden from
the API as that the user of the object can see the propery as a simple attribute of
an object.

Barry

>
> Thanks in advance,
>
> Irv
> --
> https://mail.python.org/mailman/listinfo/python-list
>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor