Skip to main content
 首页 » 编程设计

python之使用文档字符串记录 Pythons @property "attributes"

2024年11月01日29bhlsheji

<分区>

我认为文档字符串更多的是个人偏好,但我想听听一些比我聪明的人的意见......

这是记录 get/set nature pythons @property 描述符属性的合法方式吗?

class Handle(rgm.RigModule): 
    ''' 
    Handle nodes are intended to be keyable transforms, made viewable by shape nodes connected as children 
 
    @Properties: 
 
        parent: 
            Transform: Returns Transform instance if parent exists, otherwise None 
        parent.setter: 
            (str): Sets parent transform. (Accepts string name of transform, or any instance of the Transform class) 
 
        shape: 
            str: returns string representation of current shape 
        shape.setter: 
            (str): sets current shape using string representation provided.  If string key does not exist in library, shape will be set to None 
 
        shapeDraw: 
            dict: returns dictionary of shape data 
        shapeDraw.setter: 
            (dict): sets current shapes using data 
 
        shapeColor: 
            int: returns integer representation of current shape color 
        shapeColor.setter: 
            (int): sets current shape color using integer provided. 
 
        shapeColor: 
            int: returns integer representation of current shape color 
        shapeColor.setter: 
            (int): sets current shape color using integer provided. 
 
        shapeTranslate: 
            list: returns a 3list of the shape nodes relative offset translation 
        shapeTranslate.setter: 
            (list): sets relative offset translation of the shape nodes 
 
        shapeRotate: 
            list: returns a 3list of the shape nodes relative offset rotation 
        shapeRotate.setter: 
            (list): sets relative offset rotation of the shape nodes 
 
        shapeScale: 
            list: returns a 3list of the shape nodes relative offset scale 
        shapeScale.setter: 
            (list): sets relative offset scale of the shape nodes 
 
        shapeMatrix: 
            list: returns a 8list of the shape nodes relative offset matrix 
        shapeMatrix.setter: 
            (list): sets relative offset matrix of the shape nodes