Mercurial > slides-fragments
changeset 139:f358a14dd01a
created
| author | 127.0.0.1 |
|---|---|
| date | Wed, 29 Jan 2014 20:07:04 +0100 |
| parents | 86e0cb53e631 |
| children | aac0c1a9092b |
| files | super |
| diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/super Wed Jan 29 20:07:04 2014 +0100 @@ -0,0 +1,21 @@ +**Wrong:** +{{{#!python +class A(object): + def foo(self, arg): + return ... + +class B(A): + def foo(self, arg): + ... + return A.foo(self, arg) +}}} + +**Better:** +{{{#!python +class B(A): + def foo(self, arg): + return super(B, self).foo(arg) +}}} + + +
