On Wed, Jan 12, 2022 at 9:11 AM Sebastian Luque <splu...@gmail.com> wrote: > > Hello, > > I am searching for a mechanism for sharing data across Examples sections > in docstrings within a class. For instance:
This seems like trying to cram too much information into the docstring, but oh well... do what you will. I'd recommend a decorator. The easiest way would probably be to have a placeholder of some sort in the actual docstring, and in the decorator, you replace __doc__ with the modified form. To do what you're asking for, your decorator would either need to go through every method in the class and mutate its docstring (in which case you'd decorate the class), or mutate the docstring of exactly one function (in which case you'd decorate that method). ChrisA -- https://mail.python.org/mailman/listinfo/python-list