Docstrings and PEP 3174
steve-REMOVE-THIS at cybersource.com.au
Mon Aug 2 05:23:08 CEST 2010
On Sun, 01 Aug 2010 20:30:22 +1200, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> If you mean a runtime optimization with no change to the source file,
>> then maybe, tell me more.
> Note that you don't necessarily need a separate file for this. It could
> just be a separate part of the same file.
I would disagree with any attempt to move the docstring away from
immediately next to the function in the source file.
You can currently do that if you insist, after all __doc__ is just an
>>> def f():
>>> f.__doc__ = some_other_text
I don't think we should do anything that *encourages* people to separate
the code and docstrings in the source file.
On the assumption that functions will continue to be written:
I like the proposal to make f.__doc__ a descriptor that lazily loads the
doc string from disk when needed, rather than keeping the string in
memory at all times. Whether this leads to enough memory savings to
justify it is an open question.
More information about the Python-list