Title: Signature.html
My limited repertoire. Actually, there wasn't much of a traceback. It came up in a small OK dialog. I copied what I could.  I see my image I used above did make it to the list, so here's the skinny.


I see Marc covered it with setattr. How does one do it with a dictionary? What else lurks out there that might be useful along these lines?

Alan Gauld wrote:
"Wayne Watson" <sierra_mtnv...@sbcglobal.net> wrote
Python doesn't like the code in the Subject (unqualified exec not allowed in function). but easily likes self.abc="22".

We'd need to see the code and traceback to guess why...

However, I'd like to assemble the assignment as a string, as shown in Subject, and execute it. Is there a way to do this?

exec is the usual way but it's also usually a bad idea.

Any reason why you want to do that rather than any of the safer alternatives? (dict, setattr etc)



--
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
            
            Shhhh, quiet. I'm thinking about filling this space. 


                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to