I have a class defined below that has a class property called 'prop', and I want the docstring 'this is a property comment' to print out. The current behavior executes the getter for the property and prints 'getter'.
Is there a way to setup the class and its metaclass so I can type 'help(MyClass.prop)' and get the docstring?
class _Metaclass(type):
@property
def prop(cls):
"""this is a property comment"""
print("getter")
return 1
@prop.setter
def prop(cls,value):
print("setter")
class MyClass(metaclass=_Metaclass):
"""this is a class comment"""
def func():
"""this is a function comment"""