今回は、Pythonのdocstring(ドックストリング)についてまとめてみました。 docstringは、Pythonコードの可読性を向上させるための非常に便利なツールです。特に、Pythonを学んでいる方や、コードの品質を向上させたい方にお役に立てればと思い執筆しました。
This module demonstrates documentation as specified by the `Google Python Style Guide`_. Docstrings may extend over multiple lines. Sections are created with a section header and a colon followed by a ...
Docstringを書く最大の即効性は、開発環境(IDE)の支援機能が強化されることです。 VS CodeやPyCharmなどのモダンなエディタでは、関数名にマウスを重ねる(ホバーする)だけで、その関数の役割や引数の説明がポップアップ表示されます。