Cloud Stack Ninja

I am looking at some Python code that has quoted strings used in a class definition in a way I hadn't seen before:

class Foo:
    """
    Docstring for the class. This one I understand, of
    course. I'm wondering about the two strings below.
    """

    one: str
    "One thing."
    another: str
    "Another thing."

    def __init__(self):
    # etc, etc.

What are those last two quoted strings for? I am guessing that the Python runtime ignores them, and there is some external tooling that uses them?



Read more here: https://stackoverflow.com/questions/64398629/what-are-these-quoted-strings-in-a-class-definition

Content Attribution

This content was originally published by Michael Geary at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: