Skip to main content Brad's PyNotes

Posts on Best-Practices

  1. PEP 257: Docstring Conventions for Self-Documenting Code

    TL;DR

    PEP 257 defines standardized conventions for Python docstrings, covering how to document modules, functions, classes, and methods using string literals that become the __doc__ attribute. The conventions emphasize triple double quotes, command-style phrasing, and consistent formatting.

  2. PEP 8: The Python Style Guide That Rules Them All

    TL;DR

    PEP 8 defines Python’s official coding style guide, emphasizing readability with 4-space indentation, descriptive naming conventions, and the principle that “code is read much more often than it is written.”