n00m wrote: > > aaah... globals()... > Then why "self" not in globals()? > > class Moo: > cnt = 0 > def __init__(self, x): > self.__class__.cnt += 1 > if self.__class__.cnt < 3: > self.x = x > else: > print id(self) > for item in globals().items(): > print item > > f = Moo(1) > g = Moo(2) > h = Moo(3)
Because self is not in globals(). It's defined as a local symbol in Moo.__init__ , supplied to that function as the first parameter. Mel. -- http://mail.python.org/mailman/listinfo/python-list