Ah, I see. Thank you all.
--
http://mail.python.org/mailman/listinfo/python-list
WaterWalk a écrit :
Hello. Consider the following two examples:
class Test1(object):
att1 = 1
def func(self):
print Test1.att1// ok
or
print type(self).att1
class Test2(object):
att1 = 1
att2 = Test2.att1 // NameError: Name Test2 is not defined
It seem
On Tue, 17 Jun 2008 23:05:56 -0700, WaterWalk wrote:
> 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
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