From: Steven D'Aprano on 1 Aug 2010 23:23 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 ordinary attribute: >>> def f(): .... pass .... >>> 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: def f(): """Doc string""" pass 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. -- Steven
First
|
Prev
|
Pages: 1 2 Prev: python and swig Next: let optionparse.Optionparser ignore unknown command line switches. |