Doc strings for a standalone app??
Rick L. Ratzel
rick.ratzel at scd.magma-da.com
Wed Jun 9 18:53:35 CEST 2004
The only perceived disadvantages that I'm aware of occur when you don't
use the -OO flag. Docstrings end up in frozen executables and .pyc
files, visible through the use of the "strings" command (which is a
problem for people who think the information is hidden from the binary
file like a comment). The binary files are also ever so slightly larger
when docstrings are used instead of comments. However, using -OO
removes docstrings in addition to applying optimizations...the frozen
executable or resulting .pyo files have no docstrings and are a bit smaller.
Peter Hansen wrote:
> j_mckitrick wrote:
>> Does it make sense to use doc strings rather than #-comments for a
>> standalone Python app? If the classes aren't going to be re-used or
>> imported, do they need them?
> The only thing I can think of to ask about that is "Why
> would you *not* want to use doc strings?". There is
> no significant overhead associated with them, so you
> don't really lose. They have potential advantages, given
> that the docs are available at runtime, more clearly
> identifiable as documentation, etc, whereas the other
> form of comments have no advantages for this kind of
> thing. So why not use them?
More information about the Python-list