3 ms·
One distinction between Lisp and Python's docstrings that he didn't mention is that in Lisp, you can (and it's normal to) give docstrings to variables; you can
by kbp 8y ago
One distinction between Lisp and Python's docstrings that he didn't mention is
that in Lisp, you can (and it's normal to) give docstrings to variables; you
can then look these up later with DOCUMENTATION or however else you read
docstrings:
CL-USER> (documentation '*print-readably* 'variable)
"If true, all objects will be printed readably. If readable printing
is impossible, an error will be signalled. This overrides the value of
*PRINT-ESCAPE*."
CL-USER> (documentation '+ 'variable)
"the value of the most recent top level READ"
CL-USER> (defvar *variable* nil "a variable")
*VARIABLE*
CL-USER> (documentation '*variable* 'variable)
"a variable"