Comment

Comment by multani

Python also has doctest https://docs.python.org/3/library/doctest.html since ... a long time now.

The documentation tools are not as advanced as Go's and as far as I know, there's no way to "run the examples" yourself.

It's a great way to write tests for some functions though, to me the sweet spot is for small, without side effects functions. It's totally possible for bigger functions but then all the initialization code and assertions can easily get in the way and make the documentation not super clear.

parent multani 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton