@@ -420,31 +420,33 @@ pub fn init(context: &PyContext) {
420420 If no argument is given, the constructor creates a new empty list.\n \
421421 The argument must be an iterable if specified.";
422422
423- context. set_attr ( list_type, "__add__" , context. new_rustfunc ( PyListRef :: add) ) ;
424- context. set_attr ( list_type, "__iadd__" , context. new_rustfunc ( PyListRef :: iadd) ) ;
425- context. set_attr ( list_type, "__contains__" , context. new_rustfunc ( PyListRef :: contains) ) ;
426- context. set_attr ( list_type, "__eq__" , context. new_rustfunc ( PyListRef :: eq) ) ;
427- context. set_attr ( list_type, "__lt__" , context. new_rustfunc ( PyListRef :: lt) ) ;
428- context. set_attr ( list_type, "__gt__" , context. new_rustfunc ( PyListRef :: gt) ) ;
429- context. set_attr ( list_type, "__le__" , context. new_rustfunc ( PyListRef :: le) ) ;
430- context. set_attr ( list_type, "__ge__" , context. new_rustfunc ( PyListRef :: ge) ) ;
431- context. set_attr ( list_type, "__getitem__" , context. new_rustfunc ( PyListRef :: getitem) ) ;
432- context. set_attr ( list_type, "__iter__" , context. new_rustfunc ( PyListRef :: iter) ) ;
433- context. set_attr ( list_type, "__setitem__" , context. new_rustfunc ( PyListRef :: setitem) ) ;
434- context. set_attr ( list_type, "__mul__" , context. new_rustfunc ( PyListRef :: mul) ) ;
435- context. set_attr ( list_type, "__len__" , context. new_rustfunc ( PyListRef :: len) ) ;
436- context. set_attr ( list_type, "__new__" , context. new_rustfunc ( list_new) ) ;
437- context. set_attr ( list_type, "__repr__" , context. new_rustfunc ( PyListRef :: repr) ) ;
438- context. set_attr ( list_type, "__doc__" , context. new_str ( list_doc. to_string ( ) ) ) ;
439- context. set_attr ( list_type, "append" , context. new_rustfunc ( PyListRef :: append) ) ;
440- context. set_attr ( list_type, "clear" , context. new_rustfunc ( PyListRef :: clear) ) ;
441- context. set_attr ( list_type, "copy" , context. new_rustfunc ( PyListRef :: copy) ) ;
442- context. set_attr ( list_type, "count" , context. new_rustfunc ( PyListRef :: count) ) ;
443- context. set_attr ( list_type, "extend" , context. new_rustfunc ( PyListRef :: extend) ) ;
444- context. set_attr ( list_type, "index" , context. new_rustfunc ( PyListRef :: index) ) ;
445- context. set_attr ( list_type, "insert" , context. new_rustfunc ( PyListRef :: insert) ) ;
446- context. set_attr ( list_type, "reverse" , context. new_rustfunc ( PyListRef :: reverse) ) ;
447- context. set_attr ( list_type, "sort" , context. new_rustfunc ( list_sort) ) ;
448- context. set_attr ( list_type, "pop" , context. new_rustfunc ( PyListRef :: pop) ) ;
449- context. set_attr ( list_type, "remove" , context. new_rustfunc ( PyListRef :: remove) ) ;
423+ extend_class ! ( context, list_type, {
424+ "__add__" => context. new_rustfunc( PyListRef :: add) ,
425+ "__iadd__" => context. new_rustfunc( PyListRef :: iadd) ,
426+ "__contains__" => context. new_rustfunc( PyListRef :: contains) ,
427+ "__eq__" => context. new_rustfunc( PyListRef :: eq) ,
428+ "__lt__" => context. new_rustfunc( PyListRef :: lt) ,
429+ "__gt__" => context. new_rustfunc( PyListRef :: gt) ,
430+ "__le__" => context. new_rustfunc( PyListRef :: le) ,
431+ "__ge__" => context. new_rustfunc( PyListRef :: ge) ,
432+ "__getitem__" => context. new_rustfunc( PyListRef :: getitem) ,
433+ "__iter__" => context. new_rustfunc( PyListRef :: iter) ,
434+ "__setitem__" => context. new_rustfunc( PyListRef :: setitem) ,
435+ "__mul__" => context. new_rustfunc( PyListRef :: mul) ,
436+ "__len__" => context. new_rustfunc( PyListRef :: len) ,
437+ "__new__" => context. new_rustfunc( list_new) ,
438+ "__repr__" => context. new_rustfunc( PyListRef :: repr) ,
439+ "__doc__" => context. new_str( list_doc. to_string( ) ) ,
440+ "append" => context. new_rustfunc( PyListRef :: append) ,
441+ "clear" => context. new_rustfunc( PyListRef :: clear) ,
442+ "copy" => context. new_rustfunc( PyListRef :: copy) ,
443+ "count" => context. new_rustfunc( PyListRef :: count) ,
444+ "extend" => context. new_rustfunc( PyListRef :: extend) ,
445+ "index" => context. new_rustfunc( PyListRef :: index) ,
446+ "insert" => context. new_rustfunc( PyListRef :: insert) ,
447+ "reverse" => context. new_rustfunc( PyListRef :: reverse) ,
448+ "sort" => context. new_rustfunc( list_sort) ,
449+ "pop" => context. new_rustfunc( PyListRef :: pop) ,
450+ "remove" => context. new_rustfunc( PyListRef :: remove)
451+ } ) ;
450452}
0 commit comments