Following sample is taken from "Dive into python" book.
class MP3FileInfo(FileInfo):
"store ID3v1.0 MP3 tags"
tagDataMap = ...
This sample shows documenting the MP3FileInfo, but how can I add help to MP3FileInfo. tagDataMap
Following sample is taken from "Dive into python" book.
class MP3FileInfo(FileInfo):
"store ID3v1.0 MP3 tags"
tagDataMap = ...
This sample shows documenting the MP3FileInfo, but how can I add help to MP3FileInfo. tagDataMap
Do it like this:
class MP3FileInfo(FileInfo):
"""Store ID3v1.0 MP3 tags."""
@property
def tagDataMap(self):
"""This function computes map of tags.
The amount of work necessary to compute is quite large, therefore
we memoize the result.
"""
...
Note though you really shouldn't make a separate docstring if the attribute has only a one-line description. Instead, use
class MP3FileInfo(FileInfo):
"""Store ID3v1.0 MP3 tags.
Here are the attributes:
tagDataMap -- contains a map of tags
"""
tagDataMap = ...