Overloading =
jhefferon at my-deja.com
jhefferon at my-deja.com
Thu Feb 17 17:47:50 EST 2000
I have a class, rclass. It has an attribute value. Can I arrange
so that the string
r1=r2
sets r1.value to equal r2.value (where r1 and r2 are class instances,
of course) without changing anything else about r1? I'm willing to
test, say, that r1.classtype==r2.classtype or something, first to make
sure the assignment is sensible.
And if so, can I also have r1=7 set r1.value to be 7?
I want to have a box in a GUI where users can enter code, such as
assignments, and I'd like to avoid the reference to the underlying
attribute.
Thanks,
Jim Hefferon jim at joshua.smcvt.edu
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list