encapsulating a global variable

BlindAnagram blindanagram at nowhere.com
Tue Feb 25 08:09:27 EST 2020


On 25/02/2020 12:56, Chris Angelico wrote:
> On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram <blindanagram at nowhere.com> wrote:
>>
>> I would appreciate advice on whether it is possible to avoid the use of
>> a global variable used in a function by encapsulating it in a class
>> without maaking any changes to the call interface (which I cannot change).
> 
> Why bother? If you aren't changing where the function's called, then
> its state is effectively global anyway, so what's the point of the
> class?

It's a good question!

The main reason is that I would like to know if it is possible as I then
have a choice.  The choice might not be there.

  Brian


More information about the Python-list mailing list