<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Andreas Löscher wrote:
<blockquote cite="mid:%3C1271844236.4631.9.camel@laptop%3E" type="cite">
<pre wrap="">You can do something like this:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">class A(): pass
inst=)
exec("""
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->... a=
... b=2
... c=3
... d=4
... """) in inst.__dict__
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap=""> inst.a
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->1
</pre>
<pre wrap=""><!---->
This executes the Statement in the exec function and uses inst.__dict__
as namespace. But be aware, that this is not recommended. If you mess
with __dict__, you won't be able to replace it with some logic
(parameter) if you need to do something more than setting a variable.
Best</pre>
</blockquote>
Hi Andreas, thanks for the reply,<br>
<br>
Looks like I'll be sticking with repeating the class-name for a while.<br>
<br>
Regards,<br>
Alan<br>
</body>
</html>