object-identity

In Ruby, why does inspect() print out some kind of object id which is different from what object_id() gives?

When the p function is used to print out an object, it may give an ID, and it is different from what object_id() gives. What is the reason for the different numbers? Update: 0x4684abc is different from 36971870, which is 0x234255E >> a = Point.new => #<Point:0x4684abc> >> a.object_id => 36971870 >> a.__id__ => 36971870 >> "%X" % a....

String concatenation in Python.

Can you describe difference between two ways of string concatenation: simple __add__ operator and %s patterns? I had some investigation in this question and found %s (in form without using parentheses) a little faster. Also another question was appeared: why result of 'hell%s' % 'o' refers to another memory region than 'hell%s' % ('o',)...