class A(B): """ Здесь текст $var """
Можно как-нибудь вывести в этой строке результат функции var, определенной в классе В?
class A(B): """ Здесь текст $var """
class a: @staticmethod def hello(): return 10 class b(a): __doc__ = """ Hello it is {0} """.format(a.hello()) print(b.__doc__) x = b() print(x.__doc__)
>>> class A: ... """ ... 123 ... """ >>> A.__doc__ '\n 123\n ' >>> A.__doc__ = "12345445" >>> A.__doc__ '12345445'