1class foo():
2 def __init__(self, kind=None):
3 self.kind = kind
4 def my_print(self):
5 print (self.kind)
6 return self
7 @property
8 def line(self):
9 self.kind = 'line'
10 return self
11 @property
12 def bar(self):
13 self.kind='bar'
14 return self
15
16a = foo()
17a.line
18a.my_print()
19a.bar
20a.my_print()
21
22assert a.kind == 'bar'
23
24b = foo()
25b.line.my_print().bar.my_print()
26assert b.kind == 'bar'
27
28c = foo().line.my_print().bar.my_print()
29assert c.kind == 'bar'
1a = foo()
2a.line()
3a.my_print()
4a.bar()
5a.my_print()
6
7assert a.kind == 'bar'