R
Robert Brewer
18536648Andrew said:Hmmm... If I create MyClass as above, I get the following results
which I don't understand:
<bound method MyClass.newmethod of <__main__.MyClass instance
at 0x008E93A0>>
<bound method MyClass.newmethod of <__main__.MyClass instance
at 0x008E93A0>>
9355504
Why do mc.method0 and mc.method1 appear to be the same object?
Even more confusing to me is:
... def method0(self):
... pass
... def method1(self):
... pass
... def method2(self):
... pass
...
9918464
Here f.method1 and f.method2 share the same id, which is different to
that of f.method1...
Can anyone enlighten me as to why this happens?
...further:
....so the id() result is mutating somehow, even for the same object.
This is true for both old- and new-style classes, by the way, and also
holds for methods where you don't simply pass (I tried return 0,
return1, and return 2, for example function bodies)
Hmmm...
Robert Brewer
MIS
Amor Ministries
(e-mail address removed)