Another of those "is" issues.

"Martin v. Löwis" martin at v.loewis.de
Sat Mar 21 21:17:58 CET 2009


>>>> m is c.myMethod
> False  <--- What? Why is that?

I think nobody has said this plainly yet (although Terry
points it out also): You cannot rely that

  foo.bar is foo.bar

for any object foo and any attribute bar. In some cases,
that relation may hold, in other cases, it may not.
It depends on whether foo intercepts access to bar and
returns something different each time.

As others have explained: objects return something new
for every access to a method.

Regards,
Martin



More information about the Python-list mailing list