On Mon, 04 Jul 2005 02:50:07 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: >On Sun, 03 Jul 2005 22:07:30 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: > >>Bengt Richter wrote: >> >> >>class foo(object): >> x = 1 >> y = 2 >> z = 3 >> def __init__(self,x=x,y=y,z=z): >> save_these = subdict(locals(),['x','y']) >> self.__dict__.update(save_these) > self.__dict__.update({'x':x, 'y':y, 'z':z}) # should work without > save_these oops, I see you only wanted x and y, so that should be self.__dict__.update({'x':x, 'y':y}) # should work without save_these >> >> # rest of code >> print self.x, self.y, self.z >> >>f = foo() >>f = foo(5,6,7) >>
Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list