James Henstridge wrote:
>
> I was thinking about this a bit today, and it has one hole in it.
> Consider this code:
Ah yes. Here is another, more alarming, example:
from gtk import *
from GDK import *
button1 = GtkButton()
def cb(btn):
btn.foo="Bye" # sets foo in btn.__dict__ and widget data
button1.connect("clicked", cb)
button1.foo = "Hello" # set foo in button1.__dict__ and in widget data
print button1.foo # prints Hello, from looking in button1.__dict__
button1.clicked() # button1.__dict__[foo] is still 'Hello',
although
# widget data contains 'Bye'
print button1.foo # prints Hello, from looking in button1.__dict__
> Granted that your patch is better than any I have posted so far, but is
> this acceptable behaviour? If people think it is OK, I will apply it.
> But if people think that this will cause more confusion than it reduces,
> I will have to comment out this section of the code.
Well, my opinion is that this isn't really acceptable. Knowing about it
in advance, it's relatively easy to avoid. However, it's too easy for a
new user to stumble on to, too likely to introduce bugs into existing
code, and too subtle to track down easily.
I think until we are able to pass the original python object to signal
handlers, we are better off just not having user-created attributes
available to the signal handlers.
Other opinions will differ....
--
Richard Fish Enhanced Software Technologies, Inc.
Software Developer 4014 E Broadway Rd Suite 405
[EMAIL PROTECTED] Phoenix, AZ 85040
(602) 470-1115 http://www.estinc.com
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]