I tried to find an answer to this pretty specific question but nearly seems like nobody is asking that question and its not even hindering my progress but I just want to know why.
class Member:
def __init__(self, name):
self.name = name
def getname(self):
return self.name
member1 = Member("John")
print(member1.name)
print(member1.getname())
In this example I get the exact same result, I even checked with the type() function to see if there would be any difference but no.
Is there even any difference apart from one beeing a function. Is one of these methods superior to the other and if there is no difference why do so many people use a function to return a value?
And if this question has been asked already could you provide a link?
Thank you I really appreciate any effort