mirror of
https://github.com/python/cpython.git
synced 2025-11-13 23:46:24 +00:00
SF bug #805304: super instances don't support item assignment
Document a nuance of super(). It is designed to work well with dotted attribute lookup but not with equivalent implicit lookups using operators or statements.
This commit is contained in:
parent
6c06cd5ff9
commit
cb40ba1f5e
1 changed files with 6 additions and 0 deletions
|
|
@ -996,6 +996,12 @@ class C(B):
|
||||||
def meth(self, arg):
|
def meth(self, arg):
|
||||||
super(C, self).meth(arg)
|
super(C, self).meth(arg)
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
|
Note that \function{super} is implemented as part of the binding process for
|
||||||
|
explicit dotted attribute lookups such as
|
||||||
|
\samp{super(C, self).__getitem__(name)}. Accordingly, \function{super} is
|
||||||
|
undefined for implicit lookups using statements or operators such as
|
||||||
|
\samp{super(C, self)[name]}.
|
||||||
\versionadded{2.2}
|
\versionadded{2.2}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue