are docstrings for variables a bad idea?

jelle jelleferinga at gmail.com
Fri Apr 21 09:01:34 EDT 2006


didn't you just do that ;')

such variables docstrings would help one to speed up understanding an
API, and more importantly, could reduce assumptions you make on what a
variable means.
who's the mother of assumptions again?

i'm not evangalizing at all that each and every variable should be
documented!
but one cannot deny there is a certain degree of entropy in the
understanding of classes you even wrote yourself. so variables
docstrings could be very helpful notes to oneself and others.

imagine you wrote a python script that runs a FEM simlation overnight,
relating drag to speed.

rcar.speed -> 'resulting velocity to rcar.drag'

these little notes could help you not to make the same false assumption
you've overcome a year ago, and are likely to make again.

also in cases (most) where you are not the sole operator on a class,
these little hints can be appreciated.

a variables doctring should never be longer than 2 lines to be any good
likely.
ok.
3

-jelle




More information about the Python-list mailing list