Re:Minimal examples of data structures and algorithms in Python
by a3n on Monday April 24, 2017 @08:49PM
(#14189876)
Suggestion: a short main() and if __name__ = ... for each file, serving as a demo/smoke test. It doesn't stop you from importing it as a module, and it's nice to see using code.
[ Parent
| on HN ]
Re:Minimal examples of data structures and algorithms in Python
by felixhummel on Tuesday April 25, 2017 @06:30AM
(#14192225)
Along the same lines - use doctests maybe?
if __name__ == "__main__":
import doctest
doctest.testmod()
https://docs.python.org/3.5/library/doctest.html