Consider a trivial print
helper method - that has the intention to reduce typing / clutter for a specifically formatted output structure:
class MyClass(object):
def p(self, msg,o=None):
import datetime
omsg = ": %s" %repr(o) if o is not None else ""
print("[%s] %s%s\n" %(str(datetime.datetime.now()).split('.')[0], msg, omsg))
The point of making it short/sweet was not to then type
self.p('Hello world')
But is that the only option?
Note: I want to distribute this class within a small team - and not add a function
p()
to their namespaces.