Juan Manuel Macías <maciasch...@posteo.net> writes: Hello Juan!
> I can duplicate the text, but it seems to be a bit redundant, right? > So what is the best way to proceed when doing literate programming > with any language that supports docstrings? Apologies in advance if > the question is a bit silly, but I'm not a professional programmer and > don't have an academic background in it, so I don't know if there is > any good practice on these things :-) A "bit silly" question? I find your question rather profound. Thank you for bringing it up! Personally, I recommend to use both docstrings and literate programming idiomatically, not mixing them. Literate programming exposes thinking and exploration. For example, the literate portion can show different approaches you tried but abandoned, something that does not belong to the function itself, nor in its docstring. Or, it can include examples, piece-wise performance analysis, computer science background, mathematical model, citations of prior work, and so on. Add some assertions and you will have literate tests as well. A docstring describes the function from the outside, as a black box, and if you did a good job with it, it makes it simpler for the consumer to use your function. Literate programming, on the other hand, goes deeper. It describes the thinking that went into the function, comfortably exposing its insides and opening the black box of its abstraction. Rudy -- "Strange as it may sound, the power of mathematics rests on its evasion of all unnecessary thought and on its wonderful saving of mental operations." -- Ernst Mach, 1838-1916 Rudolf Adamkovič <salu...@me.com> [he/him] Studenohorská 25 84103 Bratislava Slovakia