Arthur wrote:
On Sat, 2004-12-18 at 15:56 -0800, Scott David Daniels wrote:
Arthur wrote:
... to get my bi-directional communication, all I need to do is setattr(Display,"control_panel",self) in the __init__ of the Tk ControlPanel... My first ever use of setattr. Knew it was there for something ;)
Hmmm.... Outside of playing with setattr, why not use: Display.control_panel = self ... On the other hand I am sometimes forced into some ingenuity in the use of what I *do* know, and feel I sometimes end up with something that avoids being more occult than necessary - whereas someone more comfortable at those levels may have immediately jumped there for a solution.
OK, I was doing two things, (1) suggesting another simpler (more readable) form, and (2) honestly asking whether this was, in fact, a reasonable substitution, or whether there was a consideration that I hadn't understood. I always wind up with crappy code on my way to programs I like. Writing code, like writing English, is a process of inspiration and rework. I like the process in code, and hate the same process for writing English. Probably for two reasons. First, I have been harassed while writing English so often that I hear all such nonsense when I write. This is really the effect of bad teaching. Second, I am a prolific reader, and I very much appreciate good writing at the caliber of "the dozen best in a century." I read my writing and I notice a dramatic distance between my best and their (published) worst. Tough competition. -- -- Scott David Daniels Scott.Daniels@Acm.Org