I ran across a Python behavior that seems very strange to me, and I would like to understand it. 

Normally I expect the [`id`](https://docs.python.org/2/library/functions.html#id) function to always return the same value when I pass the same object to it. In CPython it corresponds to the location of the object in memory.

When I create an object and apply `id` the result is always the same, but when I use `id` on a bound method of the object the result changes. Why is this? Is a new method being created each time I get the method attribute?

I first noticed this in IPython, but it was more difficult to make a script that shows the same behavior. Maybe this is partially an IPython thing?

I did manage to write a small block that partially recreates the behavior. 

```
# Create an object

class Foo(object):
    def bar(self):
        pass

obj = Foo()

for _ in range(10):
    print(id(obj))
# ... prints the same number

for _ in range(10):
    print(id(obj.bar))
# ... in this case the first number is different and the rest are the same

```

This is slightly different than just pasting the line `print(id(obj.bar))` into IPython a bunch of times because the returned ids are *mostly* consistent. However, when I just run the above code as a python script, all the numbers are the same, so it seems that this is an IPython quirk. I guess the question now is: why?