On Sep 20, 10:16 am, Peng Yu <pengyu...@gmail.com> wrote: (snip) > I am more familiar with C++ than python. So I need to connect python > concept to C++ concept so that I can understand it better. > > name1 and name are all references (in the C++ sense), right? > > __repr__ and __str__ are references (in the C++ sense) to functions > and both of them could refer to the same function or two different > ones, right?
Don't ever try and map C++ to Python on a 1:1 basis or you will get quite confused. Try this thought experiment, and remember, the Python shell is your best friend now! IDLE 2.6.2 >>> a = 1 >>> b = 1 >>> a 1 >>> b 1 >>> id(a) 27822424 >>> id(b) 27822424 >>> help(id) Help on built-in function id in module __builtin__: id(...) id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) NOW you can apply that logic 1:1 to your python problem ;-) -- http://mail.python.org/mailman/listinfo/python-list