picop.cymethod#
Bound-method helpers.
- picop.cymethod.cfunction_check(o)#
Return True if
ois a C function object (PyCFunction_Check).Notes
Matches builtin functions and bound C methods such as
[].append; unbound descriptors such asstr.joinare notPyCFunctionobjects. APyCMethodpasses here but not incfunction_check_exact.
- picop.cymethod.cfunction_check_exact(o)#
Return True if
ois exactlyPyCFunction(PyCFunction_CheckExact).
- picop.cymethod.cfunction_get_self(func)#
Return the object a C function is bound to (its
__self__), orNone.Notes
PyCFunction_GetSelfhands back the borrowedm_self: builtin functions report thebuiltinsmodule andMETH_STATICfunctions reportNone. A non-C-function argument raisesSystemError.
- picop.cymethod.classmethod_new(callable)#
Return
classmethod(callable)viaPyClassMethod_New.
- picop.cymethod.cmethod_check(o)#
Return True if
ois a C method (PyCMethod_Check).Notes
A
PyCMethodis aPyCFunctioncarrying the defining class, built byPyCMethod_New; unbound descriptors such asstr.joinare notPyCFunctionobjects at all.
- picop.cymethod.cmethod_check_exact(o)#
Return True if
ois exactlyPyCMethod(PyCMethod_CheckExact).
- picop.cymethod.method_check(o)#
Return True if
ois a bound method (PyMethod_Check).
- picop.cymethod.method_eq(a, b)#
Return True if methods equal (same function +
__self__; not identity).
- picop.cymethod.method_get_function(meth)#
Return the underlying function via checked
PyMethod_Function.Notes
Preferred spelling of
method_function.
- picop.cymethod.method_get_self(meth)#
Return
__self__via checkedPyMethod_Self.Notes
Preferred spelling of
method_self.
- picop.cymethod.method_new(func, self)#
Return a bound method for
funcandself(PyMethod_New).