「prop」という名前のクラス プロパティを持つ以下に定義されたクラスがあり、「これはプロパティ コメントです」というドキュメント文字列を出力したいと考えています。現在の動作は、プロパティの getter を実行し、'getter' を出力します。
「help(MyClass.prop)」と入力して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"""