method-wrapper?

David wizzardx at gmail.com
Sun Jun 1 12:46:28 CEST 2008


> What is "method-wrapper"?  Google turns up hardly any hits, same with
> searching python.org.
>

It probably means that one object (A) contains another object (B).
When you call certain methods on object A, those methods call methods
in B, and return B's results to A's caller.

>From that docstring:

A.__call__() will run B()
A.__cmp__(C) will run cmp(B, C)

etc.

In other words python code which runs A() will be running the
equivalent of A.B(), where A can do other things besides calling B()
if it wants to.

David.



More information about the Python-list mailing list