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 nearest I got was: ------------------------- class orientate(object): seen = defaultdict() @classmethod def do(self, piece, two_sided=False): ------------------------ which works but requires a change to the function call interface from orientate(piece) to orientate.do(piece). I was hoping that repalcing the above with: ------------------------- class orientate(object): seen = defaultdict() @classmethod def __call__(self, piece, two_sided=False): ------------------------ would eliminate the need for the 'do' but this gives the error: builtins.TypeError: orientate() takes no arguments Brian -- https://mail.python.org/mailman/listinfo/python-list