Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper Google docstring for lists

I've been using the Google Docstring format described here but I'm wondering if there is an agreed upon method for documenting lists of a known type.

I've been using

def function(a_list)
    """

    Args:
        a_list (list[dict]): a list of dictionaries
    """
    ...

Is this correct?

like image 820
Eric Blum Avatar asked Nov 08 '22 06:11

Eric Blum


1 Answers

Given the advances in type hinting that didn't exist when I first asked this question I would now defer to that style:

from typing import List

def function(a_list: List[dict])
    """

    Args:
        a_list (List[dict]): a list of dictionaries
    """
    ...
like image 163
Eric Blum Avatar answered Dec 19 '22 19:12

Eric Blum