@@ -226,13 +226,23 @@ static mp_obj_t list_insert(mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj) {
226226 return mp_const_none ;
227227}
228228
229+ static mp_obj_t list_remove (mp_obj_t self_in , mp_obj_t value ) {
230+ assert (MP_OBJ_IS_TYPE (self_in , & list_type ));
231+ mp_obj_t args [] = {self_in , value };
232+ args [1 ] = list_index (2 , args );
233+ list_pop (2 , args );
234+
235+ return mp_const_none ;
236+ }
237+
229238static MP_DEFINE_CONST_FUN_OBJ_2 (list_append_obj , mp_obj_list_append ) ;
230239static MP_DEFINE_CONST_FUN_OBJ_1 (list_clear_obj , list_clear ) ;
231240static MP_DEFINE_CONST_FUN_OBJ_1 (list_copy_obj , list_copy ) ;
232241static MP_DEFINE_CONST_FUN_OBJ_2 (list_count_obj , list_count ) ;
233242static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_index_obj , 2 , 4 , list_index ) ;
234243static MP_DEFINE_CONST_FUN_OBJ_3 (list_insert_obj , list_insert ) ;
235244static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_pop_obj , 1 , 2 , list_pop ) ;
245+ static MP_DEFINE_CONST_FUN_OBJ_2 (list_remove_obj , list_remove ) ;
236246static MP_DEFINE_CONST_FUN_OBJ_2 (list_sort_obj , list_sort ) ;
237247
238248const mp_obj_type_t list_type = {
@@ -251,6 +261,7 @@ const mp_obj_type_t list_type = {
251261 { "index" , & list_index_obj },
252262 { "insert" , & list_insert_obj },
253263 { "pop" , & list_pop_obj },
264+ { "remove" , & list_remove_obj },
254265 { "sort" , & list_sort_obj },
255266 { NULL , NULL }, // end-of-list sentinel
256267 },
0 commit comments