On Wednesday 12 September 2007 17:39, Brendan Barnwell wrote:
> Ed Leafe wrote:
> > On Sep 12, 2007, at 6:19 PM, johnf wrote:
> >> Sorry my email ISP went down and couldn't respond earlier.  Anyway
> >> I am trying
> >> to create a new attribute for the object.  I was hoping not to use
> >> "exec"
> >> because I have heard it is a large performance hit.
> >
> >     It is not a question of performance; it is a question of having side
> > effects that may not be obvious until you understand the inner
> > workings of Python. It's one of those "be sure you know what you're
> > doing" things.
>
>       Yes, and in this case there's no need to use exec and no reason to 
> expose
> yourself to its peculiarities.  If you want to create a new attribute, just
> use setattr:
>
> setattr(self, curlabel, "this is the new label")
Although, I have not tested yet - this looks perfect!
-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to