From 107516aa5684a7d5cac6bf092b53f8053b2844a1 Mon Sep 17 00:00:00 2001 From: Nanguage Date: Wed, 22 Feb 2023 22:23:53 +0800 Subject: [PATCH] update docs --- docs/basic_usage.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/basic_usage.md b/docs/basic_usage.md index e26668a..c1a09b5 100644 --- a/docs/basic_usage.md +++ b/docs/basic_usage.md @@ -20,6 +20,22 @@ def print_person(name: str, age: Val(int, [0, 120])): print(f"{name} is {age} years old.") ``` +You can also mark arguments using decorators in [`funcdesc`](https://github.com/Nanguage/funcdesc): + +```Python +from oneface import one +from funcdesc import mark_input + +@one +@mark_input("age", range=[0, 120]) +def print_person(name: str, age: int): + print(f"{name} is {age} years old.") + +``` + +This code achieves the same effect as the previous example, and you can refer to the [`funcdesc`](https://github.com/Nanguage/funcdesc) for more information about the `mark_input` decorator. + + ## Type and range checking Functions decorated with `one` will automatically check the type and range of input parameters: