diff --git a/docs/overrides/home.html b/docs/overrides/home.html index 2ead15529..601290c3c 100644 --- a/docs/overrides/home.html +++ b/docs/overrides/home.html @@ -563,10 +563,10 @@
通过 PyO3 提供完整的 Python API。使用 @as_actor 装饰器将任何类转换为分布式 Actor。
通过 PyO3 提供完整的 Python API。使用 @remote 装饰器将任何类转换为分布式 Actor。
Full Python API via PyO3. Use the @as_actor decorator to turn any class into a distributed actor.
Full Python API via PyO3. Use the @remote decorator to turn any class into a distributed actor.
from pulsing.actor import as_actor, create_actor_system, SystemConfig
+ from pulsing.actor import init, shutdown, remote
-@as_actor
+@remote
class Calculator:
def __init__(self, initial: int = 0):
self.value = initial
@@ -631,16 +631,16 @@ {% if config.theme.language == "zh" %}运行它{% else %}Run It{% endif %}
import asyncio
async def main():
- system = await create_actor_system(SystemConfig.standalone())
+ await init()
- calc = await Calculator.local(system, initial=100)
+ calc = await Calculator.spawn(initial=100)
result = await calc.add(50) # 150
result = await calc.add(25) # 175
value = await calc.get() # 175
print(f"Final value: {value}")
- await system.shutdown()
+ await shutdown()
asyncio.run(main())