I want a class to use a modified 'print' function which only outputs when an internal flag is set:
def __quietprint(self, *args):
if not self.silent:
print(args)
The desired output, when self.silent is False, would be e.g.
self.__quietprint("E:", "-1.24")
% E: -1.24 #desired behaviour
However, the code as written, unsurprisingly in hindsight, instead outputs the tuple of *args:
self.__quietprint("E:", "-1.24")
% ("E:", -1.24) #actual behaviour
How can I achieve the desired effect?