File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,27 @@ use super::objtype;
1212
1313pub fn init ( context : & PyContext ) {
1414 let super_type = & context. super_type ;
15+
16+ let super_doc = "super() -> same as super(__class__, <first argument>)\n \
17+ super(type) -> unbound super object\n \
18+ super(type, obj) -> bound super object; requires isinstance(obj, type)\n \
19+ super(type, type2) -> bound super object; requires issubclass(type2, type)\n \
20+ Typical use to call a cooperative superclass method:\n \
21+ class C(B):\n \
22+ def meth(self, arg):\n \
23+ super().meth(arg)\n \
24+ This works for class methods too:\n \
25+ class C(B):\n \
26+ @classmethod\n \
27+ def cmeth(cls, arg):\n \
28+ super().cmeth(arg)\n ";
29+
1530 context. set_attr ( & super_type, "__init__" , context. new_rustfunc ( super_init) ) ;
31+ context. set_attr (
32+ & super_type,
33+ "__doc__" ,
34+ context. new_str ( super_doc. to_string ( ) ) ,
35+ ) ;
1636}
1737
1838fn super_init ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
You can’t perform that action at this time.
0 commit comments