|
发表于 2022-11-7 13:29:41
|
显示全部楼层
- An attribute reference is a primary followed by a period and a name:
- attributeref ::= primary "." identifier
- The primary must evaluate to an object of a type that supports
- attribute references, which most objects do. This object is then
- asked to produce the attribute whose name is the identifier. This
- production can be customized by overriding the "__getattr__()" method.
- If this attribute is not available, the exception "AttributeError" is
- raised. Otherwise, the type and value of the object produced is
- determined by the object. Multiple evaluations of the same attribute
- reference may yield different objects.
- Related help topics: getattr, hasattr, setattr, ATTRIBUTEMETHODS, FLOAT,
- MODULES, OBJECTS
复制代码
意思是(机翻):
- 属性引用是一个主属性,后面跟着一个句号和一个名称:
- Attributeref::=主“.”标识符
- 主对象必须求值为支持
- 属性引用,这是大多数对象所做的。这个对象是
- 要求生成名称为标识符的属性。这
- 可以通过重写“__getattr__()”方法来定制产品。
- 如果此属性不可用,则异常“AttributeError”是可用的
- 提高。否则,生成的对象的类型和值为
- 由物体决定。同一属性的多个求值
- 引用可以产生不同的对象。
- 相关帮助主题:getattr, hasattr, setattr, ATTRIBUTEMETHODS, FLOAT,
- 模块、对象
复制代码 |
|