Hi, When running below code, I get error saying: instance attribute "a" defined outside __init__
class Foo:
var = 9
def add(self, a, b):
self.a = a
self.b = b
print a+b
def __init__(self):
print 10
bar = Foo() # create object
bar.add(4, 7) # call method by object.method
print bar.var # access class variable
why the output prints:
10
11
9
why not serially?
9
11
10
--
https://mail.python.org/mailman/listinfo/python-list
