Ticket #25218: recursion.py

File recursion.py, 668 bytes (added by Josh Crompton, 8 years ago)
Line 
1from __future__ import unicode_literals
2
3from future.builtins import *
4from future import standard_library
5standard_library.install_aliases()
6
7from django.utils.encoding import python_2_unicode_compatible
8
9@python_2_unicode_compatible
10class Foo(object):
11
12    def __init__(self):
13        self.name = 'foo'
14
15    def __str__(self):
16        return '{}'.format(self.name)
17
18@python_2_unicode_compatible
19class Bar(Foo):
20
21    def __init__(self):
22        super().__init__()
23        self.extra = 'bar'
24
25    def __str__(self):
26        return '{} {}'.format(
27            super().__str__(),
28            self.extra,
29        )
30
31
32if __name__ == '__main__':
33    b = Bar()
34    print(b)
Back to Top