I was watching a Youtube tutorial about python classes.
This is the code he wrote.
class Tweet :
pass
a = Tweet()
a.message = '140 chars'
print (a.message)
# This works
print(Tweet.message)
# This doesn't
I understand why printing tweet.message doesn't work (or at least I think I do if its as straightforward and simple as it seems) but why does printing a.message does? I'm assuming this is something to do with how python works but what is it?
Actually now that I'm thinking about it, maybe I have it wrong. I thought Tweet.Message doesnt print because tweet does have a message you can set. But does python automatically create the ability to do a.message ? So the reason tweet.message doesnt print it because that is only a blueprint, you can only retrieve data from instances, not the actual class itself?