py: Add few more special methods.
This commit is contained in:
parent
3611c1de14
commit
e06cf89f04
12
py/objtype.c
12
py/objtype.c
|
@ -368,10 +368,12 @@ const qstr mp_binary_op_method_name[] = {
|
|||
*/
|
||||
[MP_BINARY_OP_ADD] = MP_QSTR___add__,
|
||||
[MP_BINARY_OP_SUBTRACT] = MP_QSTR___sub__,
|
||||
#if MICROPY_PY_ALL_SPECIAL_METHODS
|
||||
[MP_BINARY_OP_MULTIPLY] = MP_QSTR___mul__,
|
||||
[MP_BINARY_OP_FLOOR_DIVIDE] = MP_QSTR___floordiv__,
|
||||
[MP_BINARY_OP_TRUE_DIVIDE] = MP_QSTR___truediv__,
|
||||
#endif
|
||||
/*
|
||||
MP_BINARY_OP_MULTIPLY,
|
||||
MP_BINARY_OP_FLOOR_DIVIDE,
|
||||
MP_BINARY_OP_TRUE_DIVIDE,
|
||||
MP_BINARY_OP_MODULO,
|
||||
MP_BINARY_OP_POWER,
|
||||
MP_BINARY_OP_INPLACE_OR,
|
||||
|
@ -381,9 +383,9 @@ const qstr mp_binary_op_method_name[] = {
|
|||
MP_BINARY_OP_INPLACE_RSHIFT,*/
|
||||
#if MICROPY_PY_ALL_SPECIAL_METHODS
|
||||
[MP_BINARY_OP_INPLACE_ADD] = MP_QSTR___iadd__,
|
||||
[MP_BINARY_OP_INPLACE_SUBTRACT] = MP_QSTR___isub__,
|
||||
#endif
|
||||
/*MP_BINARY_OP_INPLACE_SUBTRACT,
|
||||
MP_BINARY_OP_INPLACE_MULTIPLY,
|
||||
/*MP_BINARY_OP_INPLACE_MULTIPLY,
|
||||
MP_BINARY_OP_INPLACE_FLOOR_DIVIDE,
|
||||
MP_BINARY_OP_INPLACE_TRUE_DIVIDE,
|
||||
MP_BINARY_OP_INPLACE_MODULO,
|
||||
|
|
|
@ -76,7 +76,11 @@ Q(__le__)
|
|||
Q(__ge__)
|
||||
Q(__reversed__)
|
||||
#if MICROPY_PY_ALL_SPECIAL_METHODS
|
||||
Q(__mul__)
|
||||
Q(__truediv__)
|
||||
Q(__floordiv__)
|
||||
Q(__iadd__)
|
||||
Q(__isub__)
|
||||
#endif
|
||||
|
||||
Q(micropython)
|
||||
|
|
Loading…
Reference in New Issue