how to chain methods i n pytohn clases

Solutions on MaxInterview for how to chain methods i n pytohn clases by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to chain methods i n pytohn clases"
Henry
09 Jun 2016
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    def line(self):
8        self.kind = 'line'
9        return self
10    def bar(self):
11        self.kind='bar'
12        return self