[Python-3000] The case for unbound methods?

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 9 11:31:27 CET 2008


Anthony Tolle wrote:

> So how does wrapper1 know whether it is wrapping a static method, a
> bound method, or an unbound method?  Well, one way it could do this is
> to examine the type of the descriptor it is wrapping.

No, a wrapper can't distinguish between a plain function and
an unbound method this way, because it gets called before the
function is put into a class. So it's always wrapping a plain
function, not an unbound method object.

-- 
Greg


More information about the Python-3000 mailing list