0
hello, I’m new to Python and programming in general, I just got into object orientation and I can’t understand why 'self' in the following code functions; I think because I studied an introduction of POO in c++ this python code has become very complicated. if you can compare with c++ thank you.
class Person(object):
pass
def set_name (self,name):
self.name = name
woman = Person()
set_name(woman,'julia')
print (woman.name)
#########################################.
class Person(object):
def set_name (person,name):
person.name = name
woman = Person()
woman.set_name('julia')
print (woman.name)