public object GetCustomMember(CodeContext context, string name) {
switch (name) {
// Get the module name from the function and pass that out. Note that CPython's method has
// no __module__ attribute and this value can be gotten via a call to method.__getattribute__
// there as well.
case "__module__":
return PythonOps.GetBoundAttr(context, _func, "__module__");
case "__name__":
return PythonOps.GetBoundAttr(DefaultContext.Default, _func, "__name__");
default:
object value;
string symbol = name;
if (TypeCache.Method.TryGetBoundMember(context, this, symbol, out value) || // look on method
PythonOps.TryGetBoundAttr(context, _func, symbol, out value)) { // Forward to the func
return value;
}
return OperationFailed.Value;
}
}