Understanding other people's code

Chris Angelico rosuav at gmail.com
Sat Jul 27 15:41:10 CEST 2013


On Sat, Jul 27, 2013 at 2:13 PM, Albert van der Horst
<albert at spenarnc.xs4all.nl> wrote:
> If the code is really tidy, it is possible to understand a function
> using only the *documentation* (not the code itself) of any function
> or data it uses.

I'd broaden that slightly to the function's signature, which consists
of the declaration line and any associated comments (which in Python
should be in the docstring). The docstring kinda violates this
concept, but what I generally try to explain is that you should be
able to understand a function without reading any of the indented
content.

ChrisA



More information about the Python-list mailing list