Lets say I want an integer class that lets you attach arbitrary 
attributes.  I can simply do:

class foo(int): pass

x = foo(5)
x.text = "okay"
print x, x.text   # prints "5 okay"

So, that's good.  But, how can I change the value of x from 5 to 
something else, without creating a new instance?

I suppose I could create a function that creates a new "foo" and copies 
its attributes, but is there a more direct way?  Is the value "5" stored 
in some special attribute I can just directly modify?

thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to