[Python] How do I add descriptions to class variables in Python?

Discussão em 'Python' iniciado por Stack, Setembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    I am writing a class in Python, that I will import in several different scripts, to perform a specific task.

    When I hover over the class or class functions, I can view the '''description''' that I added. However, when I hover over a class variable I only get the type hint that I added.

    In the __init__() I introduce the class variables and I've written a little #comment above each of them, so that I can always come back and identify their specific purpose. However, it would be much easier for debugging purposes to simply hover over the class variable in the code, and then see the description of that variable.

    How would I go about implementing that?

    I'll append a screenshot of the code that I am writing in VScode, so that you can see what I mean about a '''description''' appearing when I hover over the class or a class function.

    Continue reading...

Compartilhe esta Página