I am slowly absorbing these python class concepts(kinda)
this fails with an error
class Critter(object):
def __init__(self):
print "I am born"
def talk(self,name):
self.test = name
print self.test
crit = Critter('ralph')
crit.talk()
this one works
class Critter(object):
def __init__(self,name):
print "I am born"
self.test = name
print self.test
def talk(self):
print 'ya'
crit = Critter('ralph')
crit.talk()
Is the following statment true for the most part.
if a parameter is passed directly to the object, it is passed down to the __init__ constuctor only, not to any other methods. That would mean the only way to get data into an object is thru the __init__ constructor.