Also beware the difference between reassigning and extending:

class F:
  a = 3
  b = []
  def __init__(self, a, b):
    self.a = a
    self.b.append(b)
  def show(self):
    print self.a, self.b

f1=F(1,2)
f2=F(3,4)
f1.show() # 1 [2, 4]
f2.show() # 3 [2, 4]

-- 
Bob Gailer
919-636-4239 Chapel Hill, NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to