You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spyder always shows the docstring for objects on mouse hover. This works for classes and methods of classes and also for functions. But apparently not when functions are monkey patched to classes. Although printing the docstring of the patched function prints the docstring just as usual.
Example
classA:
"""Docstring of class A"""defmethod(self, x):
"""Docstring of method of class A"""passdefpatch(self, x):
"""Docstring of patch"""passA.patch=patcha=A()
print(A.__doc__) # Prints: Docstring of class A Shows on hoverprint(A.method.__doc__) # Prints: Docstring of method of class A Shows on hoverprint(A.patch.__doc__) # Prints: Docstring of patch Does not show on hoverprint(a.__doc__) # Prints: Docstring of class Shows on hoverprint(a.method.__doc__) # Prints: Docstring of method of class A Shows on hoverprint(a.patch.__doc__) # Prints: Docstring of patch Does not show on hover
Expected behavior is that the docstring of the patch is also being shown on mouse hover.
Spyder always shows the docstring for objects on mouse hover. This works for classes and methods of classes and also for functions. But apparently not when functions are monkey patched to classes. Although printing the docstring of the patched function prints the docstring just as usual.
Example
Expected behavior is that the docstring of the patch is also being shown on mouse hover.
Spyder version: 6.0.3
Python version: 3.10.4
OS: Windows 11 Enterprise 22H2
The text was updated successfully, but these errors were encountered: