@@ -198,13 +198,23 @@ static mp_obj_t list_insert(mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj) {
198198 return mp_const_none ;
199199}
200200
201+ static mp_obj_t list_remove (mp_obj_t self_in , mp_obj_t value ) {
202+ assert (MP_OBJ_IS_TYPE (self_in , & list_type ));
203+ mp_obj_t args [] = {self_in , value };
204+ args [1 ] = list_index (2 , args );
205+ list_pop (2 , args );
206+
207+ return mp_const_none ;
208+ }
209+
201210static MP_DEFINE_CONST_FUN_OBJ_2 (list_append_obj , mp_obj_list_append ) ;
202211static MP_DEFINE_CONST_FUN_OBJ_1 (list_clear_obj , list_clear ) ;
203212static MP_DEFINE_CONST_FUN_OBJ_1 (list_copy_obj , list_copy ) ;
204213static MP_DEFINE_CONST_FUN_OBJ_2 (list_count_obj , list_count ) ;
205214static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_index_obj , 2 , 4 , list_index ) ;
206215static MP_DEFINE_CONST_FUN_OBJ_3 (list_insert_obj , list_insert ) ;
207216static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_pop_obj , 1 , 2 , list_pop ) ;
217+ static MP_DEFINE_CONST_FUN_OBJ_2 (list_remove_obj , list_remove ) ;
208218static MP_DEFINE_CONST_FUN_OBJ_2 (list_sort_obj , list_sort ) ;
209219
210220const mp_obj_type_t list_type = {
@@ -224,6 +234,7 @@ const mp_obj_type_t list_type = {
224234 { "index" , & list_index_obj },
225235 { "insert" , & list_insert_obj },
226236 { "pop" , & list_pop_obj },
237+ { "remove" , & list_remove_obj },
227238 { "sort" , & list_sort_obj },
228239 { NULL , NULL }, // end-of-list sentinel
229240 },
0 commit comments