remove operator module

This commit is contained in:
blueloveTH 2024-05-03 17:41:01 +08:00
parent 022e9c53fb
commit 3278699d03
4 changed files with 0 additions and 26 deletions

View File

@ -1,14 +0,0 @@
---
icon: package
label: operator
---
The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, `operator.add(x, y)` is equivalent to the expression `x+y`.
Many function names are those used for special methods, without the double underscores.
+ `operator.lt(a, b)`
+ `operator.le(a, b)`
+ `operator.eq(a, b)`
+ `operator.ne(a, b)`
+ `operator.ge(a, b)`
+ `operator.gt(a, b)`

View File

@ -4,7 +4,6 @@
namespace pkpy{ namespace pkpy{
void add_module_operator(VM* vm);
void add_module_time(VM* vm); void add_module_time(VM* vm);
void add_module_sys(VM* vm); void add_module_sys(VM* vm);
void add_module_json(VM* vm); void add_module_json(VM* vm);

View File

@ -2,16 +2,6 @@
namespace pkpy{ namespace pkpy{
void add_module_operator(VM* vm){
PyObject* mod = vm->new_module("operator");
vm->bind_func<2>(mod, "lt", [](VM* vm, ArgsView args) { return VAR(vm->py_lt(args[0], args[1]));});
vm->bind_func<2>(mod, "le", [](VM* vm, ArgsView args) { return VAR(vm->py_le(args[0], args[1]));});
vm->bind_func<2>(mod, "eq", [](VM* vm, ArgsView args) { return VAR(vm->py_eq(args[0], args[1]));});
vm->bind_func<2>(mod, "ne", [](VM* vm, ArgsView args) { return VAR(vm->py_ne(args[0], args[1]));});
vm->bind_func<2>(mod, "ge", [](VM* vm, ArgsView args) { return VAR(vm->py_ge(args[0], args[1]));});
vm->bind_func<2>(mod, "gt", [](VM* vm, ArgsView args) { return VAR(vm->py_gt(args[0], args[1]));});
}
struct PyStructTime{ struct PyStructTime{
int tm_year; int tm_year;
int tm_mon; int tm_mon;

View File

@ -1611,7 +1611,6 @@ void VM::post_init(){
add_module_gc(this); add_module_gc(this);
add_module_random(this); add_module_random(this);
add_module_base64(this); add_module_base64(this);
add_module_operator(this);
_lazy_modules["this"] = kPythonLibs_this; _lazy_modules["this"] = kPythonLibs_this;
_lazy_modules["functools"] = kPythonLibs_functools; _lazy_modules["functools"] = kPythonLibs_functools;