chore(comments): Test 仓注释英文化(R11)
把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
This commit is contained in:
1 parent
aa5a7e7250
commit
ee6461be46
81 files changed
+1231
-1925
No files matched your search
@@ -5,50 +5,50 @@ import testcheck
|
||||
|
||||
|
||||
# ============================================================
|
||||
# ExpandKeywordsTest - 验证 def 别名关键字 fn/fun/func/function
|
||||
# 语义与 def 完全相同(定义/调用/嵌套/泛型/空函数体)
|
||||
# ExpandKeywordsTest - verify def alias keywords fn/fun/func/function;
|
||||
# identical semantics to def (define/call/nest/generic/empty body).
|
||||
# ============================================================
|
||||
|
||||
# fn: 单参数返回
|
||||
# fn: single argument, returns value
|
||||
fn add_one(x: int) -> int:
|
||||
return x + 1
|
||||
|
||||
|
||||
# fun: 双参数返回
|
||||
# fun: two arguments, returns value
|
||||
fun add_two(a: int, b: int) -> int:
|
||||
return a + b
|
||||
|
||||
|
||||
# func: 浮点参数返回
|
||||
# func: float arguments
|
||||
func mul_float(a: double, b: double) -> double:
|
||||
return a * b
|
||||
|
||||
|
||||
# function: 内部用 def 定义再调用(别名与 def 混用)
|
||||
# function: defines and calls an inner def (alias mixed with def)
|
||||
function get_ten() -> int:
|
||||
def inner() -> int:
|
||||
return 10
|
||||
return inner()
|
||||
|
||||
|
||||
# fn 泛型(PEP 695 风格类型参数)
|
||||
# fn generic (PEP 695 style type parameters)
|
||||
fn ident[T](x: T) -> T:
|
||||
return x
|
||||
|
||||
|
||||
# fn 空函数体(pass)
|
||||
# fn empty body (pass)
|
||||
fn noop():
|
||||
pass
|
||||
|
||||
|
||||
# fun 递归
|
||||
# fun recursion
|
||||
fun fact(n: int) -> int:
|
||||
if n <= 1:
|
||||
return 1
|
||||
return n * fact(n - 1)
|
||||
|
||||
|
||||
# func 多语句 + 局部变量
|
||||
# func multiple statements + local variable
|
||||
func avg3(a: double, b: double, c: double) -> double:
|
||||
total: double = a + b + c
|
||||
return total / 3.0
|
||||
|
||||
Reference in new issue
Block a user