Skip to content

Commit 8336eb0

Browse files
committed
Complete the emulation of MethodType.
1 parent 155fdf2 commit 8336eb0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Doc/howto/descriptor.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,16 @@ roughly equivalent to:
11411141
obj = self.__self__
11421142
return func(obj, *args, **kwargs)
11431143
1144+
def __getattribute__(self, name):
1145+
"Emulate method_getset() in Objects/classobject.c"
1146+
if name == '__doc__':
1147+
return self.__func__.__doc__
1148+
return object.__getattribute__(self, name)
1149+
1150+
def __getattr__(self, name):
1151+
"Emulate method_getattro() in Objects/classobject.c"
1152+
return getattr(self.__func__, name)
1153+
11441154
To support automatic creation of methods, functions include the
11451155
:meth:`__get__` method for binding methods during attribute access. This
11461156
means that functions are non-data descriptors that return bound methods

0 commit comments

Comments
 (0)