@@ -1025,25 +1025,31 @@ available. They are listed here in alphabetical order.
10251025 sequence of strings is by calling ``''.join(sequence) ``.
10261026
10271027
1028- .. function :: super(type[, object-or-type])
1028+ .. function :: super([ type[, object-or-type] ])
10291029
1030- .. XXX need to document PEP "new super"
1030+ .. XXX updated as per http://www.artima.com/weblogs/viewpost.jsp?thread=208549 but needs checking
10311031
1032- Return the superclass of *type *. If the second argument is omitted the super
1033- object returned is unbound. If the second argument is an object,
1034- ``isinstance(obj, type) `` must be true. If the second argument is a type,
1032+ Return the superclass of *type *.
1033+
1034+ Calling :func: `super() ` without arguments is equivalent to
1035+ ``super(this_class, first_arg) ``. If called with one
1036+ argument the super object returned is unbound. If called with two
1037+ arguments and the second argument is an object, ``isinstance(obj,
1038+ type) `` must be true. If the second argument is a type,
10351039 ``issubclass(type2, type) `` must be true.
10361040
10371041 A typical use for calling a cooperative superclass method is::
10381042
10391043 class C(B):
1040- def meth (self, arg):
1041- super(C, self).meth (arg)
1044+ def method (self, arg):
1045+ super().method(arg) # This does the same thing as: super( C, self).method (arg)
10421046
10431047 Note that :func: `super ` is implemented as part of the binding process for
1044- explicit dotted attribute lookups such as ``super(C, self ).__getitem__(name) ``.
1048+ explicit dotted attribute lookups such as ``super().__getitem__(name) ``.
10451049 Accordingly, :func: `super ` is undefined for implicit lookups using statements or
1046- operators such as ``super(C, self)[name] ``.
1050+ operators such as ``super()[name] ``. Also, :func: `super ` is not
1051+ limited to use inside methods: under the hood it searches the stack
1052+ frame for the class (``__class__ ``) and the first argument.
10471053
10481054
10491055.. function :: tuple([iterable])
0 commit comments