Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > > class Test: > > a = 1 > > b = 2 > > c = 1+2 > > > > Now, all a,b and c would be directly visible to the user from the > > instance of Test. I am looking for a way to make only c directly > > visible from the instance. > > Simplest way: > > class Test: > c = 3 > > :-)
> > You know that `a`, `b` and `c` are class variables and not instance > variables!? Yes. I want to have only one class variable called c and a and b are required as temporary variables to calculate the value for c. I just found one way: class Test: a = 1 b = 2 c = a + b del a,b This one works. But I suppose there must be a way to artificially create a new block of code, some thing like this, class Test: c = None <<howToCreateANewNameSpace>>: # Objects created here are local to this scope a = 1 b = 2 global c c = a + b > > Ciao, > Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list