Mercurial > fragmenty
changeset 7:2554a94a0e0a
created
| author | 127.0.0.1 |
|---|---|
| date | Thu, 07 Oct 2010 23:32:42 +0200 |
| parents | 3dcc0d9dfdd8 |
| children | deb5eeb1ee71 |
| files | docs/super |
| diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/super Thu Oct 07 23:32:42 2010 +0200 @@ -0,0 +1,29 @@ +{{{#!python +>>> class Base(object): +... def __init__(self, *args, **kwargs): +... self.foo = 1 +... print 'base' +... +... +>>> class A(Base): +... def __init__(self, *args, **kwargs): +... super(A, self).__init__(*args, **kwargs) +... self.bar = 2 +... print 'A' +... +... +>>> class B(Base): +... def __init__(self, *args, **kwargs): +... super(B, self).__init__(*args, **kwargs) +... self.baz = 3 +... print 'B' +... +... +>>> class C(A, B): +... pass +... +>>> C() +A +B +base +}}} \ No newline at end of file
