# set\_result 方法

## 简要

设置当前可等待操作的结果，该结果可以通过访问可等待操作对象的 `result` 属性获得。

```python
def set_result(self,
    wait_result: object
)
```

值得注意的是，如果方法 `wait_for_done` 调用成功，可等待操作的结果将被覆盖。

## 参数

该方法具有以下参数，其参数、参数类型和参数描述如下：

| 参数           | 类型     | 必选 | 描述                                     |
| ------------ | ------ | -- | -------------------------------------- |
| wait\_result | object | 是  | 包含可等待操作结果的 Object 实例，该参数允许被设置为 `None`。 |

## 返回值

该方法没有返回值。

## 异常

该方法不会主动抛出异常。

## 示例

接下来我们将通过一段 Python 代码向您演示如何使用该方法：

```python
from tencent.cloud.core import errors
from tencent.cloud.core import waitable
from tencent.cloud.serverless import functions

def main():
    client: functions.Client = functions.fetch_client()

    create_operation: waitable.Waitable = client.create_layer(
        region_id = 'ap-shanghai',
        layer_name = 'default',
        layer_description = 'default layer',
        layer_content = functions.LayerContent().use_local_zip_archive(
            local_file_path = './layer.zip'
        ),
        layer_runtimes = [
            functions.FunctionRuntime.Python
        ],
        layer_license = 'default license'
    )

    create_operation.set_result(
        wait_result = 10
    )

if __name__ == '__main__':
    main()
```

## 适用于

#### Tencent Cloud SDK for Python

基础软件包：tencent-cloud-sdk-core >= 0.1.5


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/waitable/setresult-fang-fa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
