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 since get_it(piece) returns the error:

builtins.TypeError: get_it() takes no arguments

It works for me (pace sticking something in GetIt.seen to avoid getting a KeyError). You aren't muddling up the class name and instance name are you?

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to