Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Logic is the chastity belt of the mind!


devel / comp.lang.python / Re: Passing information between modules

SubjectAuthor
* Passing information between modulesStefan Ram
+* Re: Passing information between modulesTobiah
|`- Re: Passing information between modulesThomas Passin
+- Re: Passing information between modulesAxy
+* Re: Passing information between modulesdn
|+* Re: Passing information between modulesStefan Ram
||`- Re: Passing information between modulesdn
|`* Re: Passing information between modulesStefan Ram
| +* Re: Passing information between modulesdn
| |`* Re: Passing information between modulesStefan Ram
| | `- Re: Passing information between modulesBarry
| +- Re: Passing information between modulesChris Angelico
| `- Re: Passing information between modulesThomas Passin
+* Re: Passing information between modulesMichael F. Stemper
|+- Re: Passing information between modulesThomas Passin
|+- Re: Passing information between modulesThomas Passin
|`* Re: Passing information between modulesAvi Gross
| `- Re: Passing information between modulesDan Kolis
`* Re: Passing information between modulesCameron Simpson
 +- Re: Passing information between modulesDan Kolis
 `* Re: Passing information between modulesStefan Ram
  +- Re: Passing information between modulesStefan Ram
  +* Re: Passing information between modulesRoel Schroeven
  |`* Re: Passing information between modulesStefan Ram
  | `- Re: Passing information between modulesStefan Ram
  +* Re: Passing information between modulesThomas Passin
  |+* Re: Passing information between modulesDan Kolis
  ||`* Re: Passing information between modulesChris Angelico
  || `- Re: Passing information between modulesDan Kolis
  |`- Re: Passing information between modulesdn
  +- Re: Passing information between modulesRoel Schroeven
  +- Re: Passing information between modulesThomas Passin
  `- Re: Passing information between modulesThomas Passin

Pages:12
Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Sun, 20 Nov 2022 22:01:40 -0500
Lines: 11
Message-ID: <mailman.1022.1668999714.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<de1a53fe-3c3a-0507-762c-48a49fba15f3@roelschroeven.net>
<c9c5f403-4092-b90a-88ba-29d2c407f4c6@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de XTPR5qwaWw7qT4r1Cqh3RAGTUX9qILZVTS1tVGVd5kJQ==
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=QlFlYT0Q;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'roel': 0.09; 'schroeven':
0.09; 'subject:between': 0.09; 'received:10.0.0': 0.16;
'received:64.90': 0.16; 'received:64.90.62': 0.16;
'received:64.90.62.162': 0.16; 'received:dreamhost.com': 0.16;
'schreef': 0.16; 'subject:modules': 0.16; 'wrote:': 0.16; 'pm,':
0.19; 'to:addr:python-list': 0.20; 'local': 0.27; 'old': 0.27;
'it,': 0.29; 'header:User-Agent:1': 0.30; 'think': 0.32;
'received:10.0': 0.32; 'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; 'header:In-Reply-To:1':
0.34; 'use': 0.39; 'header:Received:6': 0.67; 'received:64': 0.67;
'global': 0.73; 'manage': 0.73; 'url:p': 0.88
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1668999702; a=rsa-sha256;
cv=none;
b=pZ0rXsTco9KLyL9wCRQDkKuyFrxiFiVuRclN2zp7ZWGiSax+pwfRiDpwYTgljqR4F0+q/j
RjqxUoANytbBrjtIfmYWDOf9p8PvsHSEyn2wthZ1IiLgHHaYI3KWT/FO5YPN5yZKo+b02s
UhExpM4as+JnWBV5MP1MBG/BWKhNpZMXQCyWoS+ld/DO6VOLjNTrbVpGV8DDUO3S9z6G3I
z0VwWZvGNR6qF0VtAz2DkrkQn1Meq7sRY/uOaiNqHwVrRJC2TYwSk3odEEsNZk3GCEIaVS
qy1D+Gh+EL43MbW6N+5Pa5SlDIety056vDU25B7YXEi+opuxHQ8O4ud/QR2gjQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1668999702;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=oyAPGg/oPC4yYpRIEyF8GnksYZ1SKBCxBm8MlScwb0g=;
b=w3cGjRrMLLkHn6GA566ktvjSc1QrWPdvFokgwswGAl6/RqxfkV7YIZab6VwuNEFH2mOPz7
D7/a7mu27JpoXtHhzxmbeOrF26oUiy3gLwalqeui9QpqFnWKfnwoU2uLfAqUsxBYw0zNBY
Djej6FZJZx+COcWDWVGGOiSef2qlvbCVTuDvyWnlcfym5NKKEaC5wz3NIOOGcJ+5dcu8RH
v8myY7yWsl8SMiyvdVPWgh734bgHC1BJxSzuKiDD5bygMjwjwijez0e1eAV/ktmFBIuuVC
hpFpfGwNxJxnqS9+b8eXWFkVlwChTt5jDHIG/TiHkqzHXwQOTzFS+W2RkW7yow==
ARC-Authentication-Results: i=1; rspamd-64c57ffbcf-f5dqj;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Wide-Eyed-Blushing: 5c00c1ec201fe157_1668999702580_635130155
X-MC-Loop-Signature: 1668999702580:3118308486
X-MC-Ingress-Time: 1668999702580
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1668999702;
bh=oyAPGg/oPC4yYpRIEyF8GnksYZ1SKBCxBm8MlScwb0g=;
h=Date:From:Subject:To:Content-Type:Content-Transfer-Encoding;
b=QlFlYT0Qqhwr5gzne3rWqgQKbYmWIyge9XP1re5I+CKiqwhp+xiWUdFAf5XYgGjW9
b0trEjbazDgb3Ch4UCf7s+pk40474I6Q4BPW/uZfZuB9gujNhbxUsWn1dg6IZgSbjx
iE8R21CmWuc1pjfXuuRWG1eGUsAzYbbc2uBMqYVkpylQx6O1ludWvC6qjDMgj54N72
nKldBiV3kudS16WQWBSDmOL7ZFW8emNrzLMQrU1Wazzo2OJt7wZ0Vsy4LY++hOZBnw
f89mYGiKy0rPyDf7eJWs21bRJS3FqyQYDDgbczac47p/lO9yfqaYstP7X+cg14eOX9
ODqdHNoFC/5fA==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <de1a53fe-3c3a-0507-762c-48a49fba15f3@roelschroeven.net>
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: <c9c5f403-4092-b90a-88ba-29d2c407f4c6@tompassin.net>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<de1a53fe-3c3a-0507-762c-48a49fba15f3@roelschroeven.net>
 by: Thomas Passin - Mon, 21 Nov 2022 03:01 UTC

On 11/20/2022 4:07 PM, Roel Schroeven wrote:
> Thomas Passin schreef op 20/11/2022 om 20:33:
>> https://devblogs.microsoft.com/oldnewthing/20050607-00/?p=35413
>> https://devblogs.microsoft.com/oldnewthing/20101125-00/?p=12203
>>
> Now that I think about it, The Old New Thing is also where I got the
> global vs local thing: "Don’t use global state to manage a local
> problem", https://devblogs.microsoft.com/oldnewthing/20081211-00/?p=19873
>

Bingo!

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonL...@DancesWithMice.info (dn)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 18:01:33 +1300
Organization: DWM
Lines: 12
Message-ID: <mailman.1023.1669006911.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<mailman.1019.1668972793.20444.python-list@python.org>
<CAPTjJmou1eqMxo4+wVAshzgYrQ5ABDGmfLSqG_ek7rZwGA1kzw@mail.gmail.com>
<627531c4-3397-4ec0-b789-bad233bbaf0dn@googlegroups.com>
<mailman.1021.1668984058.20444.python-list@python.org>
<43a6b362-a651-409d-a3e3-027b04550ff7n@googlegroups.com>
<145abeb4-c6a8-ba73-f559-5ac9c15a14eb@DancesWithMice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Eg0AymjRWRo5uTmwmtO6EgqwEKp4sqYxtPmPE6i2W2cw==
Return-Path: <PythonList@DancesWithMice.info>
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=danceswithmice.info header.i=@danceswithmice.info
header.b=T0Tk19r+; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '=dn': 0.09; 'dan': 0.09;
'from:addr:danceswithmice.info': 0.09; 'from:addr:pythonlist':
0.09; 'subject:between': 0.09; 'achieves': 0.16; 'message-
id:@DancesWithMice.info': 0.16; 'received:51.254': 0.16;
'received:51.254.211': 0.16; 'received:51.254.211.219': 0.16;
'received:cloud': 0.16; 'received:rangi.cloud': 0.16;
'subject:modules': 0.16; 'wrote:': 0.16; 'to:addr:python-list':
0.20; 'idea': 0.24; 'header:User-Agent:1': 0.30;
'header:Organization:1': 0.31; 'received:192.168.1': 0.32; 'header
:In-Reply-To:1': 0.34; 'received:192.168': 0.37; 'received:51':
0.64; 'your': 0.64; 'further': 0.69; 'sentence': 0.69
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 14B7C2FDC
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1669006903;
bh=CJaREtADFh0iH6EsBEEmYBhtyt98V0vytrnJOiwAMdY=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=T0Tk19r+DFpEO+WdPEHme7CuiQjWEHA2iNZ8/+uuLZXJA1fsrijIcyn3ilBldvsdt
YZDVChm4DG4dgQ+VRWV/zk6Gji3hEXlad4B3k4Fm2DP3oplrGTSN1jJAlpIaAS/t0/
r9gIaNE1HdQqNOsFlsEnmvXz1HclUDjKRRAzdcm3/UVseGtV9ObLla6p39LxSctl5K
rtO18XW7Z9h6asJxzu6ZNcTTyq2OducLhG1MssOQKgPseaRNDT4nDK+kxHEsJ33+FA
Wl9d664bNH1MtQiDeiYsvORGCWWddBdBML/+x+94D53wC21QtzZHl3pIuWMeeUG9i3
5VARTDidtfyHw==
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Content-Language: en-GB
In-Reply-To: <43a6b362-a651-409d-a3e3-027b04550ff7n@googlegroups.com>
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: <145abeb4-c6a8-ba73-f559-5ac9c15a14eb@DancesWithMice.info>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<mailman.1019.1668972793.20444.python-list@python.org>
<CAPTjJmou1eqMxo4+wVAshzgYrQ5ABDGmfLSqG_ek7rZwGA1kzw@mail.gmail.com>
<627531c4-3397-4ec0-b789-bad233bbaf0dn@googlegroups.com>
<mailman.1021.1668984058.20444.python-list@python.org>
<43a6b362-a651-409d-a3e3-027b04550ff7n@googlegroups.com>
 by: dn - Mon, 21 Nov 2022 05:01 UTC

On 21/11/2022 12.07, Dan Kolis wrote:
> If you understand its meaning, it achieves my purpose. If you don't I you're perhaps not a programmer...

Ouch!

Does the first sentence imply who is the more important person in the
interaction? Does the second further the idea that anyone/everyone who
is not at your 'level' has no worth?

--
Regards,
=dn

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 00:12:25 -0500
Lines: 15
Message-ID: <mailman.1024.1669007553.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<mailman.1019.1668972793.20444.python-list@python.org>
<CAPTjJmou1eqMxo4+wVAshzgYrQ5ABDGmfLSqG_ek7rZwGA1kzw@mail.gmail.com>
<627531c4-3397-4ec0-b789-bad233bbaf0dn@googlegroups.com>
<mailman.1021.1668984058.20444.python-list@python.org>
<43a6b362-a651-409d-a3e3-027b04550ff7n@googlegroups.com>
<145abeb4-c6a8-ba73-f559-5ac9c15a14eb@DancesWithMice.info>
<70b2fa55-4f1a-7cd8-ca2a-52a45c11cf79@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de s48DY4lHtTy9Ux+1VqVAUQM3+KSCq6Ed/1YjCNO0prTA==
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=n+W+NpHP;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'folks,': 0.07; 'dan':
0.09; 'subject:between': 0.09; 'achieves': 0.16; 'productive.':
0.16; 'received:10.0.0': 0.16; 'received:23.83.209.151': 0.16;
'received:64.90': 0.16; 'received:64.90.62': 0.16;
'received:64.90.62.162': 0.16; 'received:dreamhost.com': 0.16;
'received:quail.birch.relay.mailchannels.net': 0.16;
'subject:modules': 0.16; 'wrote:': 0.16; 'to:addr:python-list':
0.20; 'idea': 0.24; 'suggest': 0.28; 'header:User-Agent:1': 0.30;
'am,': 0.31; 'received:10.0': 0.32; 'received:mailchannels.net':
0.32; 'received:relay.mailchannels.net': 0.32; 'header:In-Reply-
To:1': 0.34; "it's": 0.37; 'your': 0.64; 'header:Received:6':
0.67; 'received:64': 0.67; 'further': 0.69; 'sentence': 0.69;
'longer': 0.71
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1669007547; a=rsa-sha256;
cv=none;
b=5z4tE7Sv+H9ZuSFS/0MIyE3GVMcikR8v67f9vPZDQ1GqkIQFYkL/07RzuuHlN+oknYHMCa
4ZNCOceP8Qbzfvd3cNbDy7NgwgA7NKv7eZ5oUQGY1qfzmTY34tui6ccYDxT07qxYPQbb/C
cw0HvXIR9jVKHY/ma6AZNf9u1Y6aGRDYeRIVc+UPMN9nNJnDpxrJZEl1gWAKoGQkcGs1Hx
s5QGaxt+da6YrvaLAot8w19w0zOrFaXwXSoZQ89OFlLM8eOuw/xyk0qzRsKSSRMhLIABgS
KGKiTMIXhxSqwWN+9iADO5mt/6ncWQZBghhopepYRBnnc4FQbHwnyRFdJ+k4pQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1669007547;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=bYzJ4ZiUh/LJD0Y2ZySWCrRP+BpzLI1Y5VRuXJwlI4s=;
b=6ibyZpVW7Zg5KRsDJUf4HNWegzJSXPW7pw1Q8Cc859akJEPTQiTiMqaXlrDSb8zOSfS3dj
KFVJcVcLFFZTQkbAxPuWhzKFsOZudwLWmGrz+c9EOoorqPn/fGz9/NY6sMFHPahAfwyoG6
D6PLuJm+uE1CEnB6aHtRIUDgnMggYkH4/n3i0O22QRv9AQCAt2rchT8pCbiwrI5dGrJZBz
w3Ixd441X5QhWnaCjIjNz9ZV0ORlyeaFeJC07Kf1vMSep2fZZl66KoqGDAllau0oOO7cGN
ZeXRqUXazzPIE53XD9rgR0W9HuP6lYaK0Fbe8WAReRZW8EEJ9cv3zPHGHKXWwg==
ARC-Authentication-Results: i=1; rspamd-65567d767-qn787;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Scare-Broad: 2e26332e4dba930e_1669007547765_1987210057
X-MC-Loop-Signature: 1669007547765:2041172345
X-MC-Ingress-Time: 1669007547765
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1669007547;
bh=bYzJ4ZiUh/LJD0Y2ZySWCrRP+BpzLI1Y5VRuXJwlI4s=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=n+W+NpHPWWVP7RvNuJzKN/Rnq9qFxdfxx86klRVa9kLwXbOx9o2SNbNKA9wodS2r2
8Jrhkv6e+h9kf4Z+wQIFAo1IgXIm1PDcQRDSSib3tKM7l7zGUC50xERZ7UeO+15LX/
fKQpVDlqkJeZup+JE37OK1/lI3jFZ5g70POP8Z2qFRSQc0oG3V1swzDxM+3KEGJDqG
8C8ctuaUV+9w39VNW0d1S6rzS0zo+4cPgFM2y+aH2IPUqyyaUQrX/Id6VbQrUFVTlF
u+qHazQY6bPvgvht0Oha+pxLkC86WIRfwaMkFe8ktXnMMGfwT8p6KN1bJFXYJ+j2bf
f/QiOXZh66yCQ==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <145abeb4-c6a8-ba73-f559-5ac9c15a14eb@DancesWithMice.info>
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: <70b2fa55-4f1a-7cd8-ca2a-52a45c11cf79@tompassin.net>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<Y3laeSPoJWiiwUGh@cskk.homeip.net>
<mailman.1008.1668897405.20444.python-list@python.org>
<parameters-20221120113207@ram.dialup.fu-berlin.de>
<2b030783-d879-924d-d581-89f73c262427@tompassin.net>
<b85207c0-b8f0-2a17-c241-0b0ddc71b02b@roelschroeven.net>
<mailman.1019.1668972793.20444.python-list@python.org>
<CAPTjJmou1eqMxo4+wVAshzgYrQ5ABDGmfLSqG_ek7rZwGA1kzw@mail.gmail.com>
<627531c4-3397-4ec0-b789-bad233bbaf0dn@googlegroups.com>
<mailman.1021.1668984058.20444.python-list@python.org>
<43a6b362-a651-409d-a3e3-027b04550ff7n@googlegroups.com>
<145abeb4-c6a8-ba73-f559-5ac9c15a14eb@DancesWithMice.info>
 by: Thomas Passin - Mon, 21 Nov 2022 05:12 UTC

On 11/21/2022 12:01 AM, dn wrote:
> On 21/11/2022 12.07, Dan Kolis wrote:
>> If you understand its meaning, it achieves my purpose. If you don't I
>> you're perhaps not a programmer...
>
> Ouch!
>
> Does the first sentence imply who is the more important person in the
> interaction? Does the second further the idea that anyone/everyone who
> is not at your 'level' has no worth?

Folks, this is getting into ad hominem territory. I suggest it's time
to end the thread, since it's no longer productive.

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonL...@DancesWithMice.info (dn)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 18:24:41 +1300
Organization: DWM
Lines: 95
Message-ID: <mailman.1025.1669008297.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
<869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de IhBIweSIiF++7c9zbm2bfwfhwQcDVy28NbcyRgEL/uDw==
Return-Path: <PythonList@DancesWithMice.info>
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=danceswithmice.info header.i=@danceswithmice.info
header.b=Z1eKLoKy; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.012
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'def': 0.04; 'gui': 0.05;
'all!': 0.07; 'class.': 0.07; 'explicitly': 0.07; 'field.': 0.07;
'formal': 0.07; 'ram': 0.07; '=dn': 0.09;
'from:addr:danceswithmice.info': 0.09; 'from:addr:pythonlist':
0.09; 'subject:between': 0.09; 'writes:': 0.09; '"print': 0.16;
"'m'": 0.16; 'append': 0.16; 'attributes': 0.16; 'gui.': 0.16;
'message-id:@DancesWithMice.info': 0.16; 'print(': 0.16;
'received:51.254': 0.16; 'received:51.254.211': 0.16;
'received:51.254.211.219': 0.16; 'received:cloud': 0.16;
'received:rangi.cloud': 0.16; 'refactoring': 0.16;
'subject:modules': 0.16; 'whichever': 0.16; 'wrote:': 0.16;
'python': 0.16; 'probably': 0.17; 'to:addr:python-list': 0.20;
'instructions': 0.22; 'skip:_ 10': 0.22; 'code': 0.23; 'classes':
0.26; 'interface': 0.26; 'library': 0.26; 'object': 0.26;
'stefan': 0.26; 'output': 0.28; 'thinking': 0.28; 'example,':
0.28; 'header:User-Agent:1': 0.30; 'module': 0.31;
'header:Organization:1': 0.31; 'program': 0.31; 'think': 0.32;
"doesn't": 0.32; 'question': 0.32; '"this': 0.32; 'context': 0.32;
'suitable': 0.32; 'received:192.168.1': 0.32; 'but': 0.32;
'there': 0.33; 'requires': 0.34; 'header:In-Reply-To:1': 0.34;
'running': 0.34; 'fine': 0.35; 'functions': 0.36; 'work,': 0.36;
"skip:' 10": 0.37; 'using': 0.37; 'class': 0.37;
'received:192.168': 0.37; 'could': 0.38; 'two': 0.39; 'text':
0.39; 'handle': 0.39; 'use': 0.39; 'define': 0.40; 'both': 0.40;
'something': 0.40; 'try': 0.40; 'should': 0.40; 'detail': 0.61;
'method': 0.61; 'day,': 0.62; 'skip:m 20': 0.63; 'in:': 0.64;
'received:51': 0.64; 'your': 0.64; 'produce': 0.65; 'now,': 0.67;
'prevent': 0.67; 'manager': 0.68; 'collect': 0.69; 'facility':
0.69; 'factor': 0.69; 'risk': 0.71; 'skip:* 10': 0.71; '(you':
0.76; 'handles': 0.76; 'vary': 0.76; 'major': 0.78; 'dangerous':
0.81; '"."': 0.84; 'choices': 0.84; 'coded': 0.84; 'how,': 0.84;
'inherited': 0.84; 'method,': 0.84; 'minor': 0.84; 'signature.':
0.84; 'stage,': 0.84; 'replacing': 0.91
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 31F182FDC
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1669008289;
bh=0N6sHNyM5Hbk0JxmMFfEPiOT3TZ05NahNai/TzbUmao=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=Z1eKLoKyJIjrKPtLIlwAVyjP0cBF+Z3AIk6hxxKhgE2UQ6IbSOdn0G6JFxFh5X5Ry
eaSESj9SvZv2Cwogt5z6S7QogGWTJjDWXJSzdJ7CnmTTBfC9fmMT3nVN3LfyYcANr2
9jAg8u9mpqh92zIzfY6t76DJZVsohEHDp7RERAqssn5eyLTW8+CFewyEUsdY8Xp83I
/shs4EKowLJ6udMqWgEpRBy/ior8x88KHYHS/PcUlhmKqVpleBVhRf/LTkrXeltQAK
HLYPc3l+6GEDLQPwxMoABL2yLbt0aDO1pQZ1Wl7Xh4aBbamXx7s5pgrjfo5lt1rk6W
j5RoLVYbxIdIQ==
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Content-Language: en-GB
In-Reply-To: <logging-20221120131828@ram.dialup.fu-berlin.de>
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: <869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
 by: dn - Mon, 21 Nov 2022 05:24 UTC

On 21/11/2022 01.29, Stefan Ram wrote:
> dn <PythonList@DancesWithMice.info> writes:
>> A 'standard' solution is to collect all such configuration-data at the
>> start of the application, into an object (or other data-structure) - I
>> usually call it "env" (an instantiation of "Environment").
>
> Yeah, I had some functions of my library take such an "env",
> which in my library is called "context":
>
> def python_version_check( major=3, minor=9, context=x_default_context ):
> passed = _sys.version_info >=( major, minor )
> if not passed:
> requirements_info = "This program requires Python " + \
> str( major ) + "." + str( minor )+ "+.\n"
> version_info = "Currently running under Python {}.{}.\n". \
> format( *_sys.version_info[ :2 ] )
> context.warning( requirements_info + version_info )
> return passed
>
> . But so far I am using "context" only for logging, so I am
> now thinking about replacing with Pythons logging facility.
>
> One possible application of "context", however, would also be
> normal output, which has to be shown to the user, not only
> logging as in:
>
> def show_sum( x, y, context=x_default_context ):
> context.print( f'The sum is {x+y}.' )
>
> . For example, there could by a "GUI context" by which
> "context.print" would append the output to some GUI text
> field. Using the logging facility to output text that must
> be show to the user, would abuse logging somewhat.
>
> def show_sum( x, y, context=x_default_context ):
> logger.log\
> ( my_custom_level_for_output_to_user, f'The sum is {x+y}.' )
>
> Or one could "print patch" a module, via (using the class from
> a recent post of mine):
>
> M = prepare_module( 'M' )
> M.print = my_gui_print_function
> M = M.load()
> M.f()
>
> and "show_sum" would be simply:
>
> def show_sum( x, y, context=x_default_context ):
> print( f'The sum is {x+y}.').
>
> My original question probably was intended to be something
> like: "Today, we can add attributes to a module from the
> outside. How large is the risk that this will be forbidden
> one day, so that all code using this will stop working?".

Am put-off by the 'smell' of subverting/adapting names like print() =
surprise/confusion factor - but I think I understand where you're going.

What about an ABC which is inherited by two classes. One class handles
all the detail of output to GUI. The other, similarly, output to the
terminal, log, (whatever). The ABC should require an output() method,
with suitable signature. The two classes will vary on the fine detail of
the HOW, leaving the calling-routine to produce the WHAT.

Now, at the config stage, take the instructions to define whichever the
user prefers, and instantiate that class. Then the 'calling-routine' can
use the instantiated object as an interface to whichever type of output.

If the choices on-offer include not just either/or, but also 'both of
the above'. The instantiation would need to be a class which called both
class's output() method serially.

Your use of the word "context" provoked some thought. (you don't know
just how dangerous that could become!)

In many ways, and as described, an Environment/context class could be
very easily coded with formal __enter__() and __exit__() methods. The
mainline might then become:

with Environment() as env:
# processing

There would be no need to explicitly prevent any 'processing' if the
set-up doesn't work, because that context manager class will handle it all!

NB haven't had time to try this as a refactoring exercise.

Is this how you implement?

--
Regards,
=dn

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 16:46:50 +1100
Lines: 9
Message-ID: <mailman.1026.1669009623.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
<869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
<CAPTjJmoj91pY6BeeWFvTvRLVZRt2sek_NuaNWuAYVx+YA-A0Zg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de ULapLmFiVNrM0g3AdMQ5BQwDB9QY4U73wHLygvB9VEaw==
Return-Path: <rosuav@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=XJi68BEu;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.048
X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; '2022': 0.05; 'fair,':
0.09; 'subject:between': 0.09; 'chrisa': 0.16; 'from:addr:rosuav':
0.16; 'from:name:chris angelico': 0.16; 'received:209.85.218':
0.16; 'subject:modules': 0.16; 'wrote:': 0.16; 'to:addr:python-
list': 0.20; 'function': 0.27; 'think': 0.32; 'maintaining': 0.32;
'message-id:@mail.gmail.com': 0.32; 'but': 0.32; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com':
0.35; 'mon,': 0.36; "it's": 0.37; 'received:209.85': 0.37;
'though': 0.37; 'received:209': 0.39; 'generally': 0.67; 'factor':
0.69; 'longer': 0.71; 'signature': 0.76; 'reasons': 0.84;
'statement.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=G3tD0Y3/ICHaMw7iuBbVw+CWjLCk77jSj9rV1p8EsMM=;
b=XJi68BEuI7H+7eqYoXeWB1hgNN4ZnPOfbsczKeu6yWqvACsfwG+rE49x2TTjKTz/yR
KsHOhrp5BGG819J0x4gtFV9kUPslpfJXYrkeYdznj9bhZDAEH/rjI1w1F0Qp15nnUDZE
q//WNYpHrnyknvec6ARXb56y/fVB3sAFL4/Hwbh9cQO9Y8s4GfTWyi3CmKuGUa5ZvF85
nt4FEy6tsy9L+NwHcL6wU9xlyHByS79E6ovdwBRJczwWasCDFPgV4RSUV+XquarnElQN
m3M8No+ST3vFSQk+ftF3laece7ZrxDBDfmNrqrvtbTf20hYYKyUxc5z09jSTGRu3GRvs
3ylA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=G3tD0Y3/ICHaMw7iuBbVw+CWjLCk77jSj9rV1p8EsMM=;
b=09XWYbX6l9AcFBpFu0Vl389S78QtalyvUrODqX1curYS1DotfY/ZLeouWHQczrv42X
BFTuFw2ub4MCifi/f8CVQDlhxN/AUefVuUkFXkZGhJGi6do6uqRysJ8VVaxhoGJyEB9n
73JahzYhNt130D1/r4BqQD4ZbgET/PXMyiHon9mYm8gA1rVZIUn4YUYfa5MIomlKmdkU
gVK4O9Cvfd4VIiOpJcYJJej4doO0JiNT95Nn/Avp+Ct6Ef4ceuXiMzis/SB64gg6Tvtm
RvXyIly/dDIr8D/Gc0rEEFwxCjP3T8F7xhVEqNbuX9pSbIpsQAqTb1JKuwM/0a5bPY78
5Tvg==
X-Gm-Message-State: ANoB5pnmP4G6ZVcE1vSgIyNBc76wDx6DUSYNsLTAizj46PK6WPapkfxV
xK7BYDIGUarQn0HemTl4663CkBFYjyrnbLBYSXZOmIQ5
X-Google-Smtp-Source: AA0mqf4pPfJ2InAADizpr2AbS7c3WL2rMxt0uUNxaaolfgvI3+VQqKNmmOBbQ3QCAPuHne4UPC6fDiZLoHNKPv3Ft7E=
X-Received: by 2002:a17:906:c1c6:b0:7ac:c5a4:70e7 with SMTP id
bw6-20020a170906c1c600b007acc5a470e7mr14541709ejb.13.1669009621629; Sun, 20
Nov 2022 21:47:01 -0800 (PST)
In-Reply-To: <869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
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: <CAPTjJmoj91pY6BeeWFvTvRLVZRt2sek_NuaNWuAYVx+YA-A0Zg@mail.gmail.com>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
<869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
 by: Chris Angelico - Mon, 21 Nov 2022 05:46 UTC

On Mon, 21 Nov 2022 at 16:26, dn <PythonList@danceswithmice.info> wrote:
> Am put-off by the 'smell' of subverting/adapting names like print() =
> surprise/confusion factor - but I think I understand where you're going.

To be fair, redefining the "print" function IS one of the reasons that
it's no longer a statement. Though I would generally recommend
maintaining its signature and purpose.

ChrisA

Re: Passing information between modules

<modules-20221121095206@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: 21 Nov 2022 09:03:12 GMT
Organization: Stefan Ram
Lines: 61
Expires: 1 Sep 2023 11:59:58 GMT
Message-ID: <modules-20221121095206@ram.dialup.fu-berlin.de>
References: <modules-20221118115151@ram.dialup.fu-berlin.de> <14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info> <mailman.1004.1668886667.20444.python-list@python.org> <logging-20221120131828@ram.dialup.fu-berlin.de> <869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info> <mailman.1025.1669008297.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 4rrXX5TxAjPgBQ9v2Oi8FwBoA/ldZtEQhjoAQuhcHU0FZS
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, 21 Nov 2022 09:03 UTC

dn <PythonList@DancesWithMice.info> writes:
>Now, at the config stage, take the instructions to define whichever the
>user prefers, and instantiate that class. Then the 'calling-routine' can
>use the instantiated object as an interface to whichever type of output.

I had many different functions that are supposed to take
a "context" argument. If I would make them all methods of
a class with a "context" field, that would be a huge class
containing methods with many different purposes, which
reminds of the "anti pattern" "God class".

>with Environment() as env:
> # processing
>There would be no need to explicitly prevent any 'processing' if the
>set-up doesn't work, because that context manager class will handle it all!

Yes, but my problem was not so much with setting up the env,
but with passing it to many library functions.

>Is this how you implement?

I'm not sure whether I understand the meaning of this question.

My library had a "console context" (before I started to use
the Python logging facility instead). That console context was
the default for output of progress and error messages.

A client had the possibility to call functions with a custom
context, and then the function would use this custom context
for progress and error messages. The custom context could
direct those message to a text field in a GUI, for example.

Instead of passing this custom context to many library
functions, it might be simpler to "pass it to the library
once". This could be done via:

import library
library.context = my_GUI_context

, but I wonder whether this "writing into another module"
is really possible in every Python implementation and whether
it will still be supported in the future. I do not see such
a pattern being used with the standard packages and suppose
that there might be a reason for this!

The same question applies to the more advanced technique of
using "importlib.util.find_spec", "importlib.util.module_from_spec",
and ".__spec__.loader.exec_module" to even support having
different instances of a single module with different globals.

I can now formulate my question this way:

Many functions of a library have in their source code calls
like "PRINT( f'Done. Output was written to {filename}.' )".
The library uses "print" as a default for "PRINT", but
should explicitly support clients substituting a custom
implementation to be used for "PRINT". What's the best way
for the client to "pass" his custom implementation to the
library (which is a package or a module)?

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 00:53:40 -0500
Lines: 16
Message-ID: <mailman.1027.1669026414.20444.python-list@python.org>
References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
<869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
<a5cd79e0-aa35-4a24-dcb0-610982fc1476@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de lbR46egcxIogUTigAHD2+Q/1mcpFjv8Lsg9F5lyNTbEw==
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=Op+bAsNI;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.022
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'run.': 0.05; 'modules':
0.07; 'like,': 0.09; 'received:23.83.212': 0.09;
'received:elm.relay.mailchannels.net': 0.09; 'subject:between':
0.09; 'arbitrary': 0.16; 'attributes': 0.16; 'impossible': 0.16;
'received:10.0.0': 0.16; 'received:64.90': 0.16;
'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
'received:dreamhost.com': 0.16; 'subject:modules': 0.16; 'wrote:':
0.16; 'probably': 0.17; 'to:addr:python-list': 0.20; 'code': 0.23;
'idea': 0.24; 'classes': 0.26; 'example,': 0.28; 'header:User-
Agent:1': 0.30; 'am,': 0.31; 'module': 0.31; 'question': 0.32;
'received:10.0': 0.32; 'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; 'but': 0.32; 'someone':
0.34; 'able': 0.34; 'header:In-Reply-To:1': 0.34; 'complex': 0.35;
'using': 0.37; 'class': 0.37; 'could': 0.38; 'this,': 0.39; 'use':
0.39; 'happen': 0.40; 'something': 0.40; 'today': 0.61; 'day,':
0.62; 'between': 0.63; 'time.': 0.66; 'header:Received:6': 0.67;
'received:64': 0.67; 'slots': 0.69; 'risk': 0.71; 'loss': 0.75;
'attribute': 0.84; "else's": 0.84; 'regret': 0.84; 'wherever':
0.91
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1669010021; a=rsa-sha256;
cv=none;
b=jCJx3uBT2jWz6AA9bo4MKRXPHO8oiNot9VeQk2zySpbkC77EM+064uucsW1CXV1wgrM9/X
SRPc5fC7nWC28NPtGg7wthR0X8RRAH62/3hU9P9eeQkjFaQU9ZQI3A+Rik4iCyTyfo5AMB
znYn18EjL9C5tGMk/vJgD0pJIeJcb01f9czoHGslFacpmwVevrTK52U7PpN8ylpve5BYnK
F6qpiOhnBa/9hGz8ms25QRlSwkUNiXftzpV7BdSD5mcoo/1iSVA+1Oog+wJNS2xL3Dwlg+
EZyy1hTtAO32mJD2irQ/xNWUChx9IzxGshA115oibOlgUC8opdfuutMYwperEw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1669010021;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=elmccL9DDc6/1IM4Rb5ieWgInTbEdfvILJdfJbf0QFY=;
b=vPSsHihMRVjmqXefUlD/9uQDbbzGMhZiOde1dsnJZ2NTdzozP2tkDFd8IqGQmI+oHKPCC1
aplrniDNKSzrEAlOzYpoMAHG+do94Knbs383qceqoTXetyAhriHdQrCo8l+wBMxU+Zkw/H
rRzdC6w9g2/w7j7EPhTt0egbtRyMRrX/nuUBtD3G5b/QijAF4yrT+kJJG0vitl6gkseKC/
P/V5u3zgvxmPWQOz/+ZboQzXXW1ViuvkLocCLYL4PddESue4oRaY68Jm0SByd2a3v1Q+/W
ory0ZvOYjB93YGYK4bOviFFOVcj8WHy2V9gl+l4qebmijIXFzGBV3fCnqo/1Eg==
ARC-Authentication-Results: i=1; rspamd-65567d767-86gk6;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Stretch-Plucky: 2002425e29317ad4_1669010021928_1898655392
X-MC-Loop-Signature: 1669010021928:906989218
X-MC-Ingress-Time: 1669010021928
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1669010021;
bh=elmccL9DDc6/1IM4Rb5ieWgInTbEdfvILJdfJbf0QFY=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=Op+bAsNITfmmVdQt3/fD6yHovXnwllp2xi+ycetGAzFwdvb98sDlFkyWy4IvmQw37
4k9iJobej/jyHxoj8wng/2NoKpl8D251AF39KofaE15nPBTQ/ABVQbY8D+rzDdN1cJ
ESt+BTKZZ8DLv7rnhXaM3M0jebRdKUOeByDipmyE5tnLT3sQ1ZZY4GDMKEpIx8bFdo
UkhMr6h11i/WKxkgwg+deibx2vBvgDaiCVGx3l+hQll5x0RI03x8JFPqZtJ/erGJdi
0ijKDKRo0990WaTzt+cnWKcIjZw8XSlh//Kik8VEIV/1Dy5GrhuyzAnLKCsBMUwpUy
VzK+c7grX6a1Q==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
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: <a5cd79e0-aa35-4a24-dcb0-610982fc1476@tompassin.net>
X-Mailman-Original-References: <modules-20221118115151@ram.dialup.fu-berlin.de>
<14ee5354-ecdb-1689-6917-6db7c4b6ec26@DancesWithMice.info>
<mailman.1004.1668886667.20444.python-list@python.org>
<logging-20221120131828@ram.dialup.fu-berlin.de>
<869bd30f-3e6e-6646-2e65-aa2a14cff5ec@DancesWithMice.info>
 by: Thomas Passin - Mon, 21 Nov 2022 05:53 UTC

On 11/21/2022 12:24 AM, dn wrote:
>> My original question probably was intended to be something
>>    like: "Today, we can add attributes to a module from the
>>    outside. How large is the risk that this will be forbidden
>>    one day, so that all code using this will stop working?".

This can happen today if, for example, a class is changed to use slots
for everything. Between slots and type checking, it can become
impossible to add an arbitrary attribute. *You* may be able to avoid
this, but if you use someone else's modules or classes it could happen
at any time.

I might regret the loss of being able to assign an arbitrary attribute
wherever I like, but for complex libraries, it is probably a good idea
in the long run.

Re: Passing information between modules

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry)
Newsgroups: comp.lang.python
Subject: Re: Passing information between modules
Date: Mon, 21 Nov 2022 22:17:45 +0000
Lines: 100
Message-ID: <mailman.1030.1669069084.20444.python-list@python.org>
References: <modules-20221121095206@ram.dialup.fu-berlin.de>
<6E37E704-C02C-469F-AEE9-DA080E3CBC6E@barrys-emacs.org>
Mime-Version: 1.0 (1.0)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de LOew7uLfkdFjtdNbby16JQ0Vp9wW+sRBdJZY4T8SeXSQ==
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; '(which': 0.04;
'containing': 0.05; 'library.': 0.05; 'all!': 0.07; 'class.':
0.07; 'explicitly': 0.07; 'have,': 0.07; 'cc:addr:python-list':
0.09; 'example.': 0.09; 'from:addr:barry': 0.09; 'instances':
0.09; 'messages.': 0.09; 'received:217.70': 0.09;
'received:gandi.net': 0.09; 'received:mail.gandi.net': 0.09;
'subject:between': 0.09; 'writes:': 0.09; 'cc:no real name:2**0':
0.14; 'import': 0.15; 'url:mailman': 0.15; 'problem.': 0.15;
'supported': 0.15; '2022,': 0.16; 'applies': 0.16; 'barry': 0.16;
'design.': 0.16; 'from:addr:barrys-emacs.org': 0.16; 'functions,':
0.16; 'functions.': 0.16; 'gui,': 0.16; 'had,': 0.16; 'message-id
:@barrys-emacs.org': 0.16; 'reminds': 0.16; 'subject:modules':
0.16; 'to:addr:ram': 0.16; 'to:addr:zedat.fu-berlin.de': 0.16;
'whichever': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'python':
0.16; 'instead': 0.17; 'uses': 0.19; 'calls': 0.19;
'cc:addr:python.org': 0.20; 'written': 0.22; 'advanced': 0.22;
'instructions': 0.22; 'progress': 0.22; "what's": 0.22; 'code':
0.23; 'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24':
0.25; 'url:listinfo': 0.25; 'cc:2**0': 0.25; 'url-ip:188.166/16':
0.25; 'interface': 0.26; 'library': 0.26; 'object': 0.26;
'pattern': 0.26; 'function': 0.27; 'done': 0.28; 'output': 0.28;
'error': 0.29; 'packages': 0.31; 'default': 0.31; 'module': 0.31;
'url-ip:188/8': 0.31; "doesn't": 0.32; 'question': 0.32;
'context': 0.32; 'structure': 0.32; 'but': 0.32; "i'm": 0.33;
'there': 0.33; 'same': 0.34; 'package': 0.34; 'skip:" 20': 0.34;
'header:In-Reply-To:1': 0.34; 'meaning': 0.35; 'question.': 0.35;
'yes,': 0.35; 'functions': 0.36; 'work,': 0.36; 'source': 0.36;
'those': 0.36; "skip:' 10": 0.37; 'really': 0.37; 'using': 0.37;
'class': 0.37; 'way': 0.38; 'could': 0.38; 'single': 0.39; 'text':
0.39; 'handle': 0.39; 'setting': 0.39; 'use': 0.39; 'methods':
0.39; 'still': 0.40; 'define': 0.40; 'should': 0.40; 'best': 0.61;
'above': 0.62; 'pass': 0.64; 'his': 0.65; 'look': 0.65; 'now,':
0.67; 'outside': 0.67; 'prevent': 0.67; 'received:217': 0.67;
'manager': 0.68; 'facility': 0.69; 'oriented': 0.69; 'standing':
0.69; 'free': 0.72; 'direct': 0.73; 'supposed': 0.76; 'field':
0.78; 'client': 0.82; 'calls.': 0.84; 'field,': 0.84; 'stage,':
0.84; 'this!': 0.84
In-Reply-To: <modules-20221121095206@ram.dialup.fu-berlin.de>
X-Mailer: iPad Mail (20B101)
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: <6E37E704-C02C-469F-AEE9-DA080E3CBC6E@barrys-emacs.org>
X-Mailman-Original-References: <modules-20221121095206@ram.dialup.fu-berlin.de>
 by: Barry - Mon, 21 Nov 2022 22:17 UTC

> On 21 Nov 2022, at 21:23, ram@zedat.fu-berlin.de wrote:
>
> dn <PythonList@DancesWithMice.info> writes:
>> Now, at the config stage, take the instructions to define whichever the
>> user prefers, and instantiate that class. Then the 'calling-routine' can
>> use the instantiated object as an interface to whichever type of output.
>
> I had many different functions that are supposed to take
> a "context" argument. If I would make them all methods of
> a class with a "context" field, that would be a huge class
> containing methods with many different purposes, which
> reminds of the "anti pattern" "God class".

Do you haves lots of free standing functions? Are all these functions
not part of classes?

>
>> with Environment() as env:
>> # processing
>> There would be no need to explicitly prevent any 'processing' if the
>> set-up doesn't work, because that context manager class will handle it all!
>
> Yes, but my problem was not so much with setting up the env,
> but with passing it to many library functions.

Are you writing procedural code or object oriented? Why do you have so
many functions outside of a small number of classes?

>
>> Is this how you implement?
>
> I'm not sure whether I understand the meaning of this question.

You appear not to be doing object oriented design.

>
> My library had a "console context" (before I started to use
> the Python logging facility instead). That console context was
> the default for output of progress and error messages.
>
> A client had the possibility to call functions with a custom
> context, and then the function would use this custom context
> for progress and error messages. The custom context could
> direct those message to a text field in a GUI, for example.
>
> Instead of passing this custom context to many library
> functions, it might be simpler to "pass it to the library
> once". This could be done via:
>
> import library
> library.context = my_GUI_context

That is not oo design. I get the feeling that you need a better understanding
of how to structure a non-trivia library.

If you need the context object then you must pass it around.

>
> , but I wonder whether this "writing into another module"
> is really possible in every Python implementation and whether
> it will still be supported in the future. I do not see such
> a pattern being used with the standard packages and suppose
> that there might be a reason for this!
>
> The same question applies to the more advanced technique of
> using "importlib.util.find_spec", "importlib.util.module_from_spec",
> and ".__spec__.loader.exec_module" to even support having
> different instances of a single module with different globals.
>
> I can now formulate my question this way:
>
> Many functions of a library have in their source code calls
> like "PRINT( f'Done. Output was written to {filename}.' )".
> The library uses "print" as a default for "PRINT", but
> should explicitly support clients substituting a custom
> implementation to be used for "PRINT". What's the best way
> for the client to "pass" his custom implementation to the
> library (which is a package or a module)?

Each place you have PRINT you need to have context.print calls.
You said above that you have, or had, such an object - pass it around and use it.

If passing it around is the problem then you need to look at why you code
has that problem.

Barry

>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor