Function attributes again
Fernando Rodríguez
spamers at must.die
Wed May 30 10:37:20 EDT 2001
Hi!
How can I check (from within a function) if it has attributes? I
tried if __dict__ == None in the definition, but it doesn't work:
def f(a, b):
z = 0
if __dict__ == None:
__dict__['c'] = 4
return z + a + b
>>> f(8,3)
Traceback (most recent call last):
File "<pyshell#39>", line 1, in ?
f(8,3)
File "<pyshell#28>", line 3, in f
if __dict__ == None:
NameError: global name '__dict__' is not defined
What's going on? O:-)
'Fernando
More information about the Python-list
mailing list