Public feed
#601593
def DynamicDocstringMeta(reps): def __new__(cls, name, bases, attrs): attrs['__doc__'] = attrs['__doc__'] % reps return type.__new__(cls, name, bases, attrs) return type('', (type, ), {'__new__': __new__})# test scenarioclass Test(object): """This docstring can change! (%s, %d)""" __metaclass__ = DynamicDocstringMeta(('test', 3))>>> Test().__doc__'This docstring can change! (test, 3)'