Reuse section of docstring from class

Viewed 23

I have a docstring section (from Attributes to Methods) that is exactly the same for other classes. Is there a way to make a function or something to include that section in all other classes. I'm using a parent class and if I add something else to that class, I don't want to go over all my code to make the change. Do I have to add something to the parent class to do that? I'm using python 3.9


class MaskCls(Template):
    """
    Description.....
   
    Attributes
    ----------
    array : numpy.ndarray
        Output array
    
    Methods
    -------
    mask(mask_aoi, mask_aoi_vl=None, replace_im=None, reverse=False, output=None):
    
    save(output, format_out="GTiff"):


    """
    
    def __init__(self, to_raster, from_raster, mask_rules, val_to_assign=None):
    ...
0 Answers
Related