星期四, 五月 17, 2007

python class attribute as method args?

>>> class test1:
... def __init__(self):
... self.logfile = '/var/log/httpd/access_log'
... def func(self, logfile=self.logfile):
... print logfile
...
Traceback (most recent call last):
File "", line 1, in ?
File "", line 4, in test1
NameError: name 'self' is not defined

没有评论: