On 16/07/19 10:34 AM, Mats Wichmann wrote:
On 7/15/19 3:25 PM, James Hartley wrote:
help(module_name) will place any text in the *first* module-level docstring
into the description section of the help page in Python 3.4.5. Subsequent
docstrings found at module level are ignored.
I have been using this factoid for placement of a copyright & licensing
notice. By placing a rather lengthy copyright & license in the code in a
the second module-level docstring, it is prominent within the code, but not
cluttering up help() output.
Two questions. Is there a more standardized way of including long license
descriptions in code, & is it documented that any other module-level
docstring will be ignored in help() output?
Rule #1: it's all opinion in the end...
The common practice is that licence/copyright text is included as a
comment in the code, not in a docstring.
Packaging and project templating offer/recommend a separate file for
'legal-stuff', eg licensing.
That said, I also include a one-liner at the top of every module, adding
__license__ to several other similar labels/definitions.
One thing is for-sure: when calling for help or reminding myself of
method signatures, I'd be greatly irritated by having to wade-through a
flood of irrelevance.
On the other hand, if 'you' use my work...
Whether either/both of these pass for pythonic, I can't say.
--
Regards =dn
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor