Here’s a code to an exercise in the lesson:
class Message: def __init__(self, sender, recipient, text): self.sender = sender self.recipient = recipient self.text = text class User: def __init__(self, username): self.username = username def edit_message(self, message, new_text): if message.sender == self.username: message.text = new_text
What I don’t get is how does Python know what message.sender refers to?? I thought in order to refer to the object, it would be self.sender. Similarly, I don’t know get what message.text refers to, and why is it not self.text.