Unterschied zwischen dem Aufruf einer Methode und dem Zugriff auf ein Attribut
Ich bin sehr neu in Python und benutze Python 3.3.1.
class Parent: # define parent class
parentAttr = 100
age = 55
def __init__(self):
print ("Calling parent constructor")
def setAttr(self, attr):
Parent.parentAttr = attr
class Child(Parent):
def childMethod(self):
print ('Calling child method')
Jetzt werde ich schaffen
c=child
c.[here every thing will appear methods and attr (age,setAttr)]
Wie kann ich zwischen Methoden und Attributen unterscheiden? Ich meine, wann benutze ichc.SetAtrr(Argument)
, undc.SetAtrr=value
?