question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request:

Is it possible to make the docstring show something different for a Class? For example, I use numpy docstring system and they have a slightly different format for class docstrings, the addition of an attributes section being the most notable.

For numpy, only public attributes should be listed, so maybe it could go through all the attributes and parse for ones without a leading _?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:27
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
NilsJPWernercommented, Feb 16, 2018

It’s in the works 😃

6reactions
MohamedAliRashadcommented, Jun 7, 2021

Is this still being developed or the idea died ?

I see this format to be nice for classes

class Person:
    """
    A class to represent a person.

    ...

    Attributes
    ----------
    name : str
        first name of the person
    surname : str
        family name of the person
    age : int
        age of the person

    Methods
    -------
    info(additional=""):
        Prints the person's name and age.
    """

    def __init__(self, name, surname, age):
        """
        Constructs all the necessary attributes for the person object.

        Parameters
        ----------
            name : str
                first name of the person
            surname : str
                family name of the person
            age : int
                age of the person
        """

        self.name = name
        self.surname = surname
        self.age = age

    def info(self, additional=""):
        """
        Prints the person's name and age.

        If the argument 'additional' is passed, then it is appended after the main info.

        Parameters
        ----------
        additional : str, optional
            More info to be displayed (default is None)

        Returns
        -------
        None
        """

        print(f'My name is {self.name} {self.surname}. I am {self.age} years old.' + additional)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Docstrings (With Examples) - Programiz
Python docstrings are the string literals that appear right after the definition of a function, method, class, or module. Let's take an example....
Read more >
Python Docstrings - GeeksforGeeks
Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, ...
Read more >
Documenting Python Code: A Complete Guide
Module docstrings are similar to class docstrings. Instead of classes and class methods being documented, it's now the module and any functions found...
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
Python documentation string or commonly known as docstring, is a string literal, and it is used in the class, module, function, or method...
Read more >
PEP 257 – Docstring Conventions
A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found