From 4a4eade26fdaa64c30bb396de6dcd13e4301e8ec Mon Sep 17 00:00:00 2001 From: Anurag Bhat <90216905+faze-geek@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:02:16 +0530 Subject: [PATCH] Improve Readability of example (#221) --- README.md | 4 ++-- README_zh.md | 4 ++-- docs/quick-start/installation.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c26ec0c8..fd324621 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ int main(){ // Eval the sum of the list PyObject* result = vm->eval("sum(a)"); - std::cout << py_cast(vm, result); // 6 + std::cout << "Sum of the list: "<< py_cast(vm, result) << std::endl; // 6 // Bindings vm->bind(vm->_main, "add(a: int, b: int)", @@ -104,7 +104,7 @@ int main(){ // Call the function PyObject* f_add = vm->_main->attr("add"); result = vm->call(f_add, py_var(vm, 3), py_var(vm, 7)); - std::cout << py_cast(vm, result); // 10 + std::cout << "Sum of 2 variables: "<< py_cast(vm, result) << std::endl; // 10 // Dispose the virtual machine delete vm; diff --git a/README_zh.md b/README_zh.md index 56b1c9ca..a7842f81 100644 --- a/README_zh.md +++ b/README_zh.md @@ -51,7 +51,7 @@ int main(){ // 计算列表元素之和 PyObject* result = vm->eval("sum(a)"); - std::cout << py_cast(vm, result); // 6 + std::cout << "Sum of the list: "<< py_cast(vm, result) << std::endl; // 6 // 绑定一个函数 vm->bind(vm->_main, "add(a: int, b: int)", @@ -64,7 +64,7 @@ int main(){ // 调用函数 PyObject* f_add = vm->_main->attr("add"); result = vm->call(f_add, py_var(vm, 3), py_var(vm, 7)); - std::cout << py_cast(vm, result); // 10 + std::cout << "Sum of 2 variables: "<< py_cast(vm, result) << std::endl; // 10 // 释放虚拟机 delete vm; diff --git a/docs/quick-start/installation.md b/docs/quick-start/installation.md index fe702f78..08fb4c33 100644 --- a/docs/quick-start/installation.md +++ b/docs/quick-start/installation.md @@ -102,7 +102,7 @@ int main(){ // Eval the sum of the list PyObject* result = vm->eval("sum(a)"); - std::cout << py_cast(vm, result); // 6 + std::cout << "Sum of the list: "<< py_cast(vm, result) << std::endl; // 6 // Bindings vm->bind(vm->_main, "add(a: int, b: int)", @@ -115,7 +115,7 @@ int main(){ // Call the function PyObject* f_add = vm->_main->attr("add"); result = vm->call(f_add, py_var(vm, 3), py_var(vm, 7)); - std::cout << py_cast(vm, result); // 10 + std::cout << "Sum of 2 variables: "<< py_cast(vm, result) << std::endl; // 10 // Dispose the virtual machine delete vm;