I have this noob error,
l = instanciaHagale.multiplicaMethod() AttributeError: Hagale instance has no attribute 'multiplicaMethod'
here my code:
class Hagale :
def __init__(self, a):
self.a = a
print self.a
self.sumaleAlgo = self.a+34543 #variable creada on the fly!
def multiplicaMethod (self):
return 'self.cuadradoReal'
#self.cuadradoReal = self.a * 2
instanciaHagale = Hagale(345)
print instanciaHagale.sumaleAlgo #acceso a las variables de mi objeto!
l = instanciaHagale.multiplicaMethod()
print l
The last
defis indented wrong. Outdent it so it is at the same level asdef __init__(self, a):, like this:Also note that your code uses classic classes. That’s probably not want you want, but it’s an easy fix – simply inherit from
object.