H
harold fellermann
Hi all,
I am trying to dynamically add class attributes at runtime using the
function eval(),
i.e. I want to do something like
but without knowing either the attributes name nor its value.
However, I encounter a syntax error I cannot understand:
Python 2.4 (#1, Dec 30 2004, 08:00:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<string>", line 1
X.attr = val
^
SyntaxError: invalid syntax
Does anyone have a clue what might be wrong? Thanks in advance.
- harold -
I am trying to dynamically add class attributes at runtime using the
function eval(),
i.e. I want to do something like
but without knowing either the attributes name nor its value.
However, I encounter a syntax error I cannot understand:
Python 2.4 (#1, Dec 30 2004, 08:00:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<string>", line 1
X.attr = val
^
SyntaxError: invalid syntax
Does anyone have a clue what might be wrong? Thanks in advance.
- harold -