Triple-double quote v.s. Double quote

From the PEP8 Style Guide:

  • PEP 257 describes good docstring conventions. Note that most
    importantly, the “”” that ends a multiline docstring should be on a
    line by itself, e.g.:

    """Return a foobang
    
    Optional plotz says to frobnicate the bizbaz first.
    """
    
  • For one liner docstrings, it’s okay to keep the closing “”” on the
    same line.

PEP 257 recommends using triple quotes, even for one-line docstrings:

  • Triple quotes are used even though the string fits on one line. This
    makes it easy to later expand it.

Note that not even the Python standard library itself follows these recommendations consistently. For example,

  • abcoll.py
  • ftplib.py
  • functools.py
  • inspect.py

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)