Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"What I've done, of course, is total garbage." -- R. Willard, Pure Math 430a


devel / comp.lang.python / Re: Are these good ideas?

SubjectAuthor
* Are these good ideas?Stephen Tucker
`- Re: Are these good ideas?Stefan Ram

1
Are these good ideas?

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

  copy mid

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

  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: stephen_...@sil.org (Stephen Tucker)
Newsgroups: comp.lang.python
Subject: Are these good ideas?
Date: Mon, 14 Nov 2022 17:14:05 +0000
Lines: 43
Message-ID: <mailman.976.1668446060.20444.python-list@python.org>
References: <CAP=-cKXmUobHdy7QoZjiUoseDDQt5ErnFRj2OEi+cwjtbg_JLA@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 WOCTV5m6hwY2bNGu+IYX6gzSJ4ROD/aqGtT7pnCJJa7Q==
Return-Path: <stephen_tucker@sil.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=sil.org header.i=@sil.org header.b=ZNks+6ih;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.040
X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'comments': 0.03;
'repository': 0.05; 'wanting': 0.07; 'describe': 0.09; 'module.':
0.09; 'tasks,': 0.09; 'import': 0.15; '(b)': 0.16; '(i)': 0.16;
'(ii)': 0.16; '(iii)': 0.16; 'functions.': 0.16; 'functions;':
0.16; 'layers': 0.16; 'low-level': 0.16; 'passing.': 0.16;
'values': 0.17; 'to:addr:python-list': 0.20; 'issue': 0.21;
'communicate': 0.22; 'run': 0.23; "i'd": 0.24; 'idea': 0.24;
'actual': 0.25; 'function': 0.27; 'wrong': 0.28; 'module': 0.31;
'concerned': 0.32; 'received:209.85.214': 0.32; 'to:name:python':
0.32; 'message-id:@mail.gmail.com': 0.32; 'but': 0.32;
'received:google.com': 0.34; 'particularly': 0.35; 'functions':
0.36; 'subject:ideas': 0.36; 'those': 0.36; 'missing': 0.37;
'using': 0.37; 'received:209.85': 0.37; 'way': 0.38; 'could':
0.38; 'received:209': 0.39; 'two': 0.39; 'this,': 0.39;
'considering': 0.39; 'use': 0.39; 'on.': 0.39; 'situation': 0.40;
'reasonable': 0.62; 'subject': 0.63; 'once': 0.63; 'pass': 0.64;
'down': 0.64; 'supply': 0.65; 'well': 0.65; 'years': 0.65;
'that,': 0.67; 'per': 0.68; 'order': 0.69; 'above,': 0.70;
'carry': 0.71; 'global': 0.73; 'subject:good': 0.76; '(c)': 0.81;
'comments,': 0.84; 'subject:these': 0.84; '\xe2\x80\xa6': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sil.org; s=google;
h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
:date:message-id:reply-to;
bh=7/YMlXtHY4xWxn588UrYhOrSN4jiFjnmkOmbGCQWiV4=;
b=ZNks+6ihoPA1njy6PxYYh2JL7zoWDWDhIMFJLV7gOK8zJGFeMY4ByXBzIq1gjWfzK5
APXI+gJkWJaH+vxtIeC+L98Wumr19/Qpec78pJrD3WJfBx8I1IL+fuEP1HCBGHQniWin
rwkYh0F0QpbLgjPXCBcjn24Ag7ziXYRoL1l0M=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=7/YMlXtHY4xWxn588UrYhOrSN4jiFjnmkOmbGCQWiV4=;
b=ZpRSDXetQGONsY7qSOUGXdvZISYpPSnSaei0kMJ3xOeIBsm145z3IiLQLuEiWccVLO
7PilkLk9c1rev+z3ANxBSm/muE6bZ9zEZ6JSanLBXdKK+aTdhZh5jGzmrVEyVkc9dLOf
4X8aFSNnj2KIRRbMWbdZv/4JptAhJiY3FjMKR1XFM95PYwsrZefyQEOVcGpzD11q5xoj
6c1SbjEKHSe+QEOVWAMubuna+HlQlHtd85SyA6++OCuwDLENL9obTagsXwGstNKHJxFB
+TzSU1xzMbu3/N/r0aMYdgQfQ4EdGKaQ7nT8CodIQaqzAd49/cGcw4ZczttkZvCvB+PW
MiCw==
X-Gm-Message-State: ANoB5plEbA5YaqpOExfeJdp7nSL4OGgbDMVoTd8hOo+LEor/mos4Zojy
u6CVoMoZfJHy1Fps3tTDTpdNCubEPPnMzTz1wb1ziXcr3Go69iJt
X-Google-Smtp-Source: AA0mqf6IO8wnXkr1Ib1L1HLwVlYfhapiQDGqjttlcgrDzyxSw9eHHEFCyIy8ByjSqwkXs7J5d0pWbJFCNn1FhfwTkAs=
X-Received: by 2002:a17:90a:e60f:b0:214:1a8a:a415 with SMTP id
j15-20020a17090ae60f00b002141a8aa415mr14355721pjy.197.1668446057680; Mon, 14
Nov 2022 09:14:17 -0800 (PST)
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <CAP=-cKXmUobHdy7QoZjiUoseDDQt5ErnFRj2OEi+cwjtbg_JLA@mail.gmail.com>
 by: Stephen Tucker - Mon, 14 Nov 2022 17:14 UTC

Hi,

I have two related issues I'd like comments on.

Issue 1 - Global Values

Some years ago, I had a situation where
(a) I could supply low-level functions that carry out tasks,
(b) I needed those functions to communicate with each other, but
(c) I had no access to the module that invoked my functions.

In order to achieve this, I hit on the idea that I also supply a module
that I describe as a "global values" module. This module …
(i) … defines the values that the functions use to communicate with each
other;
(ii) … is the subject of an import statement in each of my functions;
(iii) … initialises its values at the start of each run (since the import
only carries out an actual import once per session);
(iv) … acts as a repository for the values thereafter.

This solution works well.

Given that I am not particularly concerned about efficiency,
(1) Is this a reasonable way to achieve this goal?
(2) Do you know of any better ways?

Issue 2 - Passed Parameters

I am now facing another situation where I am wanting to pass 6 or 7
parameters down through several layers of logic (function A calling
function B calling ... ) and for results to be passed back.

Having had the idea described above, I am considering using it again to
save all the parameter-and-results passing.

I see nothing wrong with doing that, but I may well be missing something!

Comments, please!

Stephen Tucker.

Re: Are these good ideas?

<classes-20221114182705@ram.dialup.fu-berlin.de>

  copy mid

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

  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: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Are these good ideas?
Date: 14 Nov 2022 17:32:34 GMT
Organization: Stefan Ram
Lines: 32
Expires: 1 Sep 2023 11:59:58 GMT
Message-ID: <classes-20221114182705@ram.dialup.fu-berlin.de>
References: <mailman.976.1668446060.20444.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 0+HvEACkCZ9/O1BRA6TRTwalNqYwjbzwBMiTGbkGL4VGNc
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Mon, 14 Nov 2022 17:32 UTC

Stephen Tucker <stephen_tucker@sil.org> writes:
>Issue 1 - Global Values
>Some years ago, I had a situation where
>(a) I could supply low-level functions that carry out tasks,
>(b) I needed those functions to communicate with each other, but
>(c) I had no access to the module that invoked my functions.

One also could gather such functions in a class, then create
one object of this class in the client and call the functions
via this object. Your "globals" would become fields of this
object (class).

>I am now facing another situation where I am wanting to pass 6 or 7
>parameters down through several layers of logic (function A calling
>function B calling ... ) and for results to be passed back.

One could also gather these functions in a class and then
the client would create an object of this class passing the
seven values to the object on creation. Then he could
call the function A on this object, and A could call B from
the same object. Since the seven values are already stored
in the object, A would not have to pass them to B.
If the client would always call A after the object creation,
A also could be invoked directly from __init__. In this
case, the invocation of A would be replaced by the creation
of an object.

If no one else ever needs to call B, you could also define B
as a subfunction of A using a nested def statement. Then B
would already see the seven values passed to A.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor