Em Seg, 2006-04-10 às 03:52 -0700, [EMAIL PROTECTED] escreveu: > My Tead Lead my object counter code seen below is not pythonic
As Peter said, you should really ask your Tead Lead, but what about: class E(object): """Holds a class-wide counter incremented when it's instantiated.""" count = 0 def __init__(self): # One instance, increment the counter E.count += 1 def test(): """Test the counter class E.""" e1 = E() assert e1.count == 1 print e1.count e2 = E() assert e2.count == 2 print e2.count e3 = E() assert e3.count == 3 print e3.count if __name__ == '__main__': test() -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list