Hello. Consider the following two examples:
class Test1(object):
    att1 = 1
    def func(self):
        print Test1.att1    // ok

class Test2(object):
    att1 = 1
    att2 = Test2.att1  // NameError: Name Test2 is not defined

It seems a little strange. Why a class name can be used in a method
while cannot be used in the class block itself? I read the "Python
Reference Manual"(4.1 Naming and binding ), but didn't get a clue.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to