diff options
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/py/objlist.c b/py/objlist.c index 6c0de405fe..a656a4aeb6 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -208,14 +208,12 @@ static MP_DEFINE_CONST_FUN_OBJ_2(list_sort_obj, list_sort); const mp_obj_type_t list_type = { { &mp_const_type }, "list", - list_print, // print - list_make_new, // make_new - NULL, // call_n - NULL, // unary_op - list_binary_op, // binary_op - list_getiter, // getiter - NULL, // iternext - { // method list + .print = list_print, + .make_new = list_make_new, + .unary_op = NULL, + .binary_op = list_binary_op, + .getiter = list_getiter, + .methods = { { "append", &list_append_obj }, { "clear", &list_clear_obj }, { "copy", &list_copy_obj }, @@ -287,14 +285,8 @@ mp_obj_t list_it_iternext(mp_obj_t self_in) { static const mp_obj_type_t list_it_type = { { &mp_const_type }, "list_iterator", - NULL, // print - NULL, // make_new - NULL, // call_n - NULL, // unary_op - NULL, // binary_op - NULL, // getiter - list_it_iternext, // iternext - { { NULL, NULL }, }, // method list + .iternext = list_it_iternext, + .methods = { { NULL, NULL }, }, }; mp_obj_t mp_obj_new_list_iterator(mp_obj_list_t *list, int cur) { |