Brian van den Broek wrote:
[snip text]
<code>
class A:
def __init__(self):
self.something = None
self.something_else = None
self.still_another_thing = None
def update(self, data):
for key in metadata_dict:
if data.startswith(key):
exec('''self.%s = """%s"""''' %(metadata_dict[key],
data[len(key):]))
# triple quotes as there may be quotes in metadata
# values
break
[snip usage example and additional text]
Brian,
You could use setattr(self,metadata_dict[key],data[len(key):]).
Rich
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor