Peng Yu wrote:
<snip>
you might use:
Is __repr__ =_str__ copy by reference or by value? If I change
__str__ later on, will __repr__ be changed automatically?
Regards,
Peng
Reference or value? Neither one. This assignment is no different than
any other attribute assignment in Python. Technically, it binds the
name __repr__ to the function object already bound by __str__. You now
have a second name pointing to the same object. Rebinding one of those
names to yet another different object won't affect the other name.
name1 = "this is a test"
name2 = name1
name1 = "another string" #this has no effect on name2
print name1, name2
DaveA
--
http://mail.python.org/mailman/listinfo/python-list