Re: Are these good ideas?

2022-11-14 Thread Axy via Python-list
On 15/11/2022 04:36, Dan Stromberg wrote: On Mon, Nov 14, 2022 at 11:33 AM Axy via Python-list wrote: On 14/11/2022 17:14, Stephen Tucker wrote: > Hi, > > I have two related issues I'd like comments on. > > Issue 1 - Global Values Your "global variables" module a

Re: Are these good ideas?

2022-11-14 Thread Dan Stromberg
On Mon, Nov 14, 2022 at 11:33 AM Axy via Python-list wrote: > On 14/11/2022 17:14, Stephen Tucker wrote: > > Hi, > > > > I have two related issues I'd like comments on. > > > > Issue 1 - Global Values > > Your "global variables" module acts exactly as a singleton class. > Which is apparently a d

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
On 11/14/2022 5:36 PM, Barry wrote: On 14 Nov 2022, at 22:06, Thomas Passin wrote: For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. I used to use a dict but having been burnt with issues now create a

Re: Are these good ideas?

2022-11-14 Thread Barry
> On 14 Nov 2022, at 22:49, Chris Angelico wrote: > > On Tue, 15 Nov 2022 at 09:38, Barry wrote: >> >> >> On 14 Nov 2022, at 22:06, Thomas Passin wrote: >>> >>> For parameter passing like your #2, I have packaged them into a dictionary >>> and passed that around. It was easy enou

Re: Are these good ideas?

2022-11-14 Thread Chris Angelico
On Tue, 15 Nov 2022 at 09:38, Barry wrote: > > > > > On 14 Nov 2022, at 22:06, Thomas Passin wrote: > > > > For parameter passing like your #2, I have packaged them into a dictionary > > and passed that around. It was easy enough, and worked well. > > > I used to use a dict but having been bur

Re: Are these good ideas?

2022-11-14 Thread Barry
> On 14 Nov 2022, at 22:06, Thomas Passin wrote: > > For parameter passing like your #2, I have packaged them into a dictionary > and passed that around. It was easy enough, and worked well. > I used to use a dict but having been burnt with issues now create a class. With a class you can a

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. The only potential problem is in documenting the key/value pairs the dictionary is supposed to contain. You had better make sure it's made clear somewhere,

Re: Are these good ideas?

2022-11-14 Thread Axy via Python-list
On 14/11/2022 17:14, Stephen Tucker wrote: Hi, I have two related issues I'd like comments on. Issue 1 - Global Values Your "global variables" module acts exactly as a singleton class. Funny, you could (and maybe you do) write in your functions import global_vars_module as self as the fir

Re: Are these good ideas?

2022-11-14 Thread Weatherby,Gerard
: first : int second: str etc. I use context specific names, not “first” et. al. From: Python-list on behalf of Stephen Tucker Date: Monday, November 14, 2022 at 12:16 PM To: Python Subject: Are these good ideas? *** Attention: This is an external email. Use caution responding

Re: Are these good ideas?

2022-11-14 Thread Karsten Hilbert
Am Mon, Nov 14, 2022 at 05:14:05PM + schrieb Stephen Tucker: > 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.

Re: Are these good ideas?

2022-11-14 Thread Paul Bryan
Seems like this is a use case for context managers and/or context variables: https://docs.python.org/3/library/contextlib.html https://docs.python.org/3/library/contextvars.html On Mon, 2022-11-14 at 17:14 +, Stephen Tucker wrote: > Hi, > > I have two related issues I'd like comments on. >

Are these good ideas?

2022-11-14 Thread Stephen Tucker
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 func