8

What is the recommended way of adding a docstring for the keys of a dictionary? I am using python 2.7 and Sphinx.

For instance, in the following code, how should I mention the keys 'a' and 'b' for my_dict? (But maybe it not necessary to go in such details):

def my_func(my_dict):
    """
    :param dict {'a': float, 'b': str} my_dict: description of param
    """
    pass

The implementation above seems to be not recognized by my Pycharm editor

EDIT: I also read this post, but the answer does not mention how to specify the 'names' of the keys

RomB
  • 295
  • 3
  • 17
  • 1
    Possible duplicate of [How to add python docstring for dict](https://stackoverflow.com/questions/26712533/how-to-add-python-docstring-for-dict) – f.wue Mar 08 '19 at 08:50
  • I am certain I achieved this, several times, a few years ago, although I didn't know my Epytext from my reStructured then so it might have been the former. It rendered nicely in PyCharm. It may have been PyCharm that changed, or the default docstring format seeing as how it is usually plain for me nowadays. – John Mar 05 '23 at 19:29

0 Answers0