Re:Response to “Literate programming considered harmful”
by qznc on Wednesday August 31, 2016 @08:30AM
(#12397763)
The doc-string state pre- and post-conditions of a function and what it does in abstract terms. It should not say anything implementation specific.
For example, the doc string of "search" tells you the returned list is sorted afterwards. It should maybe tell you the complexity of its algorithm like O(n log(n)). It should NOT state which algorithm (QuickSort, TimSort, etc) it uses. Comments in the source code can explain the choice of algorithm.
For example, the doc string of "search" tells you the returned list is sorted afterwards. It should maybe tell you the complexity of its algorithm like O(n log(n)). It should NOT state which algorithm (QuickSort, TimSort, etc) it uses. Comments in the source code can explain the choice of algorithm.