On 2020-02-26, Chris Angelico wrote:
> On Thu, Feb 27, 2020 at 9:45 AM Grant Edwards
> wrote:
>>
>> On 2020-02-25, Dennis Lee Bieber wrote:
>>
>> > We seem to have some confusion with the use of the word "static"...
>>
>> No doubt carrying on the tradition from C, where the 'static' keyword
>>
On Thu, Feb 27, 2020 at 9:45 AM Grant Edwards wrote:
>
> On 2020-02-25, Dennis Lee Bieber wrote:
>
> > We seem to have some confusion with the use of the word "static"...
>
> No doubt carrying on the tradition from C, where the 'static' keyword
> is used to mean two completely different, orthogon
On 2020-02-25, Dennis Lee Bieber wrote:
> We seem to have some confusion with the use of the word "static"...
No doubt carrying on the tradition from C, where the 'static' keyword
is used to mean two completely different, orthogonal things.
--
Grant Edwards grant.b.edwards
On 25/02/2020 15:06, BlindAnagram wrote:
My interest in this stems from wanting to keep the dictionary only
available to the function that uses it and also a worry about being
called from threaded code.
Hiding your dictionary away inside a class or instance isn't going to
protect it from threa
On 26/02/20 3:56 am, BlindAnagram wrote:
Does that not have the advantage of preventing the global
directory being directly fiddled with elsewhere?
That depends on what you mean by "prevent". There is nothing
to stop any code from directly accessing the .seen attribute
of the class.
It might m
On 26/02/20 4:06 am, BlindAnagram wrote:
My interest in this stems from wanting to keep the dictionary only
available to the function that uses it and also a worry about being
called from threaded code.
Doing this won't make any difference to the way threaded code behaves.
Threading problems ne
On 25/02/2020 17:16, Christman, Roger Graydon wrote:
>> On Tue, 25 Feb 2020 3:06 PM BlindAnagram wrote:
>
>> My interest in this stems from wanting to keep the dictionary only
>> available to the function that uses it and also a worry about being
>> called from threaded code.
>
> It seems like t
BlindAnagram wrote at 2020-2-25 12:38 +:
>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).
>
>I have:
>
>
>seen
> On Tue, 25 Feb 2020 3:06 PM BlindAnagram wrote:
> My interest in this stems from wanting to keep the dictionary only
> available to the function that uses it and also a worry about being
> called from threaded code.
It seems like the simplest solution for this is to make
a completely new file
On 25/02/2020 16:36, Rhodri James wrote:
> On 25/02/2020 15:20, BlindAnagram wrote:
>>> class GetIt:
>>> seen = dict()
>>>
>>> def __call__(self, piece):
>>> return GetIt.seen[piece]
>>>
>>> get_it = GetIt()
>>>
>>> but then you have a global class instance hanging around, which is not
>
On 25/02/2020 15:20, BlindAnagram wrote:
class GetIt:
seen = dict()
def __call__(self, piece):
return GetIt.seen[piece]
get_it = GetIt()
but then you have a global class instance hanging around, which is not
actually any better than a global dictionary.
This doesn't work for me sin
On 25/02/2020 14:14, Rhodri James wrote:
> On 25/02/2020 12:38, BlindAnagram 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
On 25/02/2020 14:13, Chris Angelico wrote:
> On Wed, Feb 26, 2020 at 12:11 AM BlindAnagram
> wrote:
>>
>> On 25/02/2020 12:56, Chris Angelico wrote:
>>> On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram
>>> wrote:
I would appreciate advice on whether it is possible to avoid the use of
>>>
On 25/02/2020 14:14, Rhodri James wrote:
> On 25/02/2020 12:38, BlindAnagram 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
On 25/02/2020 12:38, BlindAnagram 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).
I have:
seen = dict()
On Wed, Feb 26, 2020 at 12:11 AM BlindAnagram wrote:
>
> On 25/02/2020 12:56, Chris Angelico wrote:
> > On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram
> > wrote:
> >>
> >> I would appreciate advice on whether it is possible to avoid the use of
> >> a global variable used in a function by encapsul
On 25/02/2020 12:50, Musbur wrote:
>
> Am 25.02.2020 13:38 schrieb BlindAnagram:
>> and I am wondering if it is possible to use a class something like
>>
>> class get_it(object):
>>
>> seen = dict()
>>
>> def __call__(piece):
>> return seen[piece]
>
> What happened when you tried it?
The
On 25/02/2020 12:56, Chris Angelico wrote:
> On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram
> 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 inter
Am 25.02.2020 13:38 schrieb BlindAnagram:
and I am wondering if it is possible to use a class something like
class get_it(object):
seen = dict()
def __call__(piece):
return seen[piece]
What happened when you tried it?
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram 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 ar
20 matches
Mail list logo