class myClass():
def __init__(self, name, age, username):
self.name = name
self.username = username
self.age = age
self.result = None
def post(self, message):
self.data = doSomethingVeryComplex()
print(message)
instance = myClass("Robstersgaming", "50", "Rob")
myClass.post(f"Hello {self.name} nice name!!! {self.age}, {self.username}, {self.data}")
I only want the message to be evaluated after doSomethingVeryComplex has given the class the data it needs. My goal is for a message to be passed into a class that use its own instance variables. however, obviously in this case I could just do f"Hello {instance.name"}
however, in my situation that is not a possibility as I don't know when the data will be put into self. I need my class to be able to entirely handle the construction of the message as soon as it gets the data. So the user will be able to input something with placeholders for variables then once the data is received and put into self it is able to evaluate it according to whatever the user put in.