Ken Schutte wrote:
> 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 s
Ken Schutte schrieb:
> 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
> somethin
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