So I’ve been messing around with this all day, and I still can’t get it to work
class pleaseWork:
def __init__(self):
self.foo=printThis(1)
self.bar=printThis(2)
def printThis(x):
if x==1:
print "foot"
elif x==2:
print "bar"
result=pleaseWork()
result.bar
It just returns
NameError: global name 'printThis' is not defined
please tell me why it’s not working…
Because
printThisis an attribute of the current object.