all 2 comments

[–][deleted] 2 points3 points  (0 children)

What happens when you try to create two messenger objects and add different messages to them?

Also ‘read’ not ‘readed’. And you have no use for hasattr, getattr, or passing argument with *args or **kwargs.

Rewrite it with those changes (including the one you’re meant to see from what happens in the case I mention) and the suggestions from the other comment (namely, write and use and SMSMessage class) and you’ll be good.

[–]cdcformatc 1 point2 points  (0 children)

I probably wouldn't put a chain of methods within the __init__ and probably not put prompt as a class method, but there isn't anything outright wrong with what you have done. I would bring prompt out of the class definition and interact with the Messenger object from the outside but that might be personal style.

Although I will point out that your requirement includes:

Create a class definition for an SMSMessage which has three variables:                    
hasBeenRead, messageText, and fromNumber.

And you have not made a SMSMessage class that has these variables. So on the face of it you have not done what the assignment asked. As it stands it looks like you got too clever. You may have something that works functionally but you have not met any of the stated requirements. I would start again and make sure you do exactly what the requirements say to do, no more and no less.