sharing data across Examples docstrings

Sebastian Luque spluque at gmail.com
Tue Jan 11 20:23:22 EST 2022


On Wed, 12 Jan 2022 09:28:16 +1100,
Cameron Simpson <cs at cskk.id.au> wrote:

[...]

> Personally I'd be inclined to put long identical examples in the class
> docstring instead of the method, but that may not be appropriate.

Good point, and perhaps it's best to put a comprehensive example in the
class docstring, rather than scatter it across the methods' docstrings.
The situation is one in which the methods are typically (but not always)
intended to be used as part of a pipeline of operations; e.g. Foo.foo()
would almost always be used before Foo.bar().

Thanks,
-- 
Seb


More information about the Python-list mailing list