Page 1 of 1

How can I create a method with 3 non-keyword parameters?

Posted: Mon Dec 23, 2019 12:10 pm
by nagylzs
We have these:

Code: Select all

MP_DEFINE_CONST_FUN_OBJ_1
MP_DEFINE_CONST_FUN_OBJ_2
MP_DEFINE_CONST_FUN_OBJ_3
But there is no

Code: Select all

MP_DEFINE_CONST_FUN_OBJ_4
. Is it intentional? Should I always use mp_arg_parse_all instead for methods with more than 3 parameters (including self)?

Re: How can I create a method with 3 non-keyword parameters?

Posted: Mon Dec 23, 2019 12:22 pm
by stijn
It's intentional for the sake of optimization.

See obj.h: more than 3 requires using MP_OBJ_FUN_MAKE_SIG with arguments and the shortcut for that is MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(objName, 4, 4).

Re: How can I create a method with 3 non-keyword parameters?

Posted: Mon Dec 23, 2019 6:09 pm
by nagylzs
Thank you!