>>>>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> (jssgc) wrote: >jssgc> This one works. But I suppose there must be a way to artificially >jssgc> create a new block of code, some thing like this,
>jssgc> class Test: >jssgc> c = None >jssgc> <<howToCreateANewNameSpace>>: >jssgc> # Objects created here are local to this scope >jssgc> a = 1 >jssgc> b = 2 >jssgc> global c >jssgc> c = a + b As you want c to be an *instance* variable, the normal idiom would be: class Test: def __init__(self): a = 1 b = 2 self.c = a+b x = Test() print x.c -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list